void InspectorTimelineAgent::startFromConsole(JSC::ExecState* exec, const String &title)
{
    // Only allow recording of a profile if it is anonymous (empty title) or does not match
    // the title of an already recording profile.
    if (!title.isEmpty()) {
        for (const TimelineRecordEntry& record : m_pendingConsoleProfileRecords) {
            String recordTitle;
            record.data->getString(ASCIILiteral("title"), recordTitle);
            if (recordTitle == title)
                return;
        }
    }

    if (!m_enabled && m_pendingConsoleProfileRecords.isEmpty())
        internalStart();

    startProfiling(exec, title, m_instrumentingAgents.inspectorEnvironment().executionStopwatch());

    m_pendingConsoleProfileRecords.append(createRecordEntry(TimelineRecordFactory::createConsoleProfileData(title), TimelineRecordType::ConsoleProfile, true, frameFromExecState(exec)));
}
void InspectorTimelineAgent::startFromConsole(JSC::ExecState* exec, const String &title)
{
    // FIXME: <https://webkit.org/b/153499> Web Inspector: console.profile should use the new Sampling Profiler

    // Only allow recording of a profile if it is anonymous (empty title) or does not match
    // the title of an already recording profile.
    if (!title.isEmpty()) {
        for (const TimelineRecordEntry& record : m_pendingConsoleProfileRecords) {
            String recordTitle;
            record.data->getString(ASCIILiteral("title"), recordTitle);
            if (recordTitle == title)
                return;
        }
    }

    if (!m_enabled && m_pendingConsoleProfileRecords.isEmpty())
        internalStart();

    JSC::LegacyProfiler::profiler()->startProfiling(exec, title, m_environment.executionStopwatch());

    m_pendingConsoleProfileRecords.append(createRecordEntry(TimelineRecordFactory::createConsoleProfileData(title), TimelineRecordType::ConsoleProfile, true, frameFromExecState(exec)));
}
void InspectorTimelineAgent::start(ErrorString&, const int* in_maxCallStackDepth) {
    if (m_enabled)
        return;

    if (in_maxCallStackDepth && *in_maxCallStackDepth > 0)
        m_maxCallStackDepth = *in_maxCallStackDepth;
    else
        m_maxCallStackDepth = 5;

    PassRefPtr<Stopwatch> stopwatch = m_globalObject.inspectorController().executionStopwatch();
    if (!stopwatch->isActive())
        stopwatch->start();

    if (m_frontendDispatcher)
        m_frontendDispatcher->recordingStarted(timestamp());

    startProfiling(m_globalObject.globalExec(), WTF::emptyString(), stopwatch);

    m_enabled = true;

    m_consoleRecordEntry = createRecordEntry(TimelineRecordFactory::createConsoleProfileData(WTF::emptyString()), TimelineRecordType::ConsoleProfile, true);
}
void InspectorTimelineAgent::pushCurrentRecord(RefPtr<InspectorObject>&& data, TimelineRecordType type, bool captureCallStack, Frame* frame)
{
    pushCurrentRecord(createRecordEntry(WTF::move(data), type, captureCallStack, frame));
}