void InspectorTimelineAgent::internalStart(const int* maxCallStackDepth) { if (m_enabled) return; if (maxCallStackDepth && *maxCallStackDepth > 0) m_maxCallStackDepth = *maxCallStackDepth; else m_maxCallStackDepth = 5; m_instrumentingAgents.setInspectorTimelineAgent(this); if (m_scriptDebugServer) m_scriptDebugServer->addListener(this); m_enabled = true; // FIXME: Abstract away platform-specific code once https://bugs.webkit.org/show_bug.cgi?id=142748 is fixed. #if PLATFORM(COCOA) m_frameStartObserver = RunLoopObserver::create(0, [this]() { if (!m_enabled || m_scriptDebugServer->isPaused()) return; if (!m_runLoopNestingLevel) pushCurrentRecord(InspectorObject::create(), TimelineRecordType::RenderingFrame, false, nullptr); m_runLoopNestingLevel++; }); m_frameStopObserver = RunLoopObserver::create(frameStopRunLoopOrder, [this]() { if (!m_enabled || m_scriptDebugServer->isPaused()) return; ASSERT(m_runLoopNestingLevel > 0); m_runLoopNestingLevel--; if (m_runLoopNestingLevel) return; if (m_startedComposite) didComposite(); didCompleteCurrentRecord(TimelineRecordType::RenderingFrame); }); m_frameStartObserver->schedule(currentRunLoop(), kCFRunLoopEntry | kCFRunLoopAfterWaiting); m_frameStopObserver->schedule(currentRunLoop(), kCFRunLoopExit | kCFRunLoopBeforeWaiting); // Create a runloop record and increment the runloop nesting level, to capture the current turn of the main runloop // (which is the outer runloop if recording started while paused in the debugger). pushCurrentRecord(InspectorObject::create(), TimelineRecordType::RenderingFrame, false, nullptr); m_runLoopNestingLevel = 1; #endif m_frontendDispatcher->recordingStarted(timestamp()); }
void LayerFlushScheduler::schedule() { if (m_isSuspended) return; m_runLoopObserver->schedule(currentRunLoop()); }