void InspectorTimelineAgent::internalStop() { if (!m_enabled) return; m_instrumentingAgents.setInspectorTimelineAgent(nullptr); if (m_scriptDebugServer) m_scriptDebugServer->removeListener(this, true); #if PLATFORM(COCOA) m_frameStartObserver = nullptr; m_frameStopObserver = nullptr; m_runLoopNestingLevel = 0; // Complete all pending records to prevent discarding events that are currently in progress. while (!m_recordStack.isEmpty()) didCompleteCurrentRecord(m_recordStack.last().type); #endif clearRecordStack(); m_enabled = false; m_startedComposite = false; m_frontendDispatcher->recordingStopped(timestamp()); }
void InspectorTimelineAgent::didPaint(const LayoutRect& rect) { TimelineRecordEntry entry = m_recordStack.last(); ASSERT(entry.type == TimelineRecordType::Paint); TimelineRecordFactory::addRectData(entry.data.get(), rect); didCompleteCurrentRecord(TimelineRecordType::Paint); }
void InspectorTimelineAgent::didWriteHTML(unsigned int endLine) { if (!m_recordStack.isEmpty()) { TimelineRecordEntry entry = m_recordStack.last(); entry.data.set("endLine", endLine); didCompleteCurrentRecord(ParseHTMLTimelineRecordType); } }
void InspectorTimelineAgent::didWriteHTML(unsigned endLine) { if (!m_recordStack.isEmpty()) { const TimelineRecordEntry& entry = m_recordStack.last(); entry.data->setInteger("endLine", endLine); didCompleteCurrentRecord(TimelineRecordType::ParseHTML); } }
void InspectorTimelineAgent::didPaint(RenderObject* renderer, const LayoutRect& clipRect) { TimelineRecordEntry& entry = m_recordStack.last(); ASSERT(entry.type == TimelineRecordType::Paint); FloatQuad quad; localToPageQuad(*renderer, clipRect, &quad); entry.data = TimelineRecordFactory::createPaintData(quad); didCompleteCurrentRecord(TimelineRecordType::Paint); }
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 InspectorTimelineAgent::didRecalculateStyle() { if (m_recordStack.isEmpty()) return; TimelineRecordEntry& entry = m_recordStack.last(); ASSERT(entry.type == TimelineRecordType::RecalculateStyles); TimelineRecordFactory::appendStyleRecalcDetails(entry.data.get(), m_styleRecalcElementCounter); m_styleRecalcElementCounter = 0; didCompleteCurrentRecord(TimelineRecordType::RecalculateStyles); }
void InspectorTimelineAgent::didLayout(RenderObject* root) { if (m_recordStack.isEmpty()) return; LayoutRect rect = root->frame()->view()->contentsToRootView(root->absoluteBoundingBoxRect()); TimelineRecordEntry entry = m_recordStack.last(); ASSERT(entry.type == TimelineRecordType::Layout); TimelineRecordFactory::addRectData(entry.data.get(), rect); didCompleteCurrentRecord(TimelineRecordType::Layout); }
void InspectorTimelineAgent::didLayout(RenderObject* root) { if (m_recordStack.isEmpty()) return; TimelineRecordEntry& entry = m_recordStack.last(); ASSERT(entry.type == TimelineRecordType::Layout); Vector<FloatQuad> quads; root->absoluteQuads(quads); if (quads.size() >= 1) TimelineRecordFactory::appendLayoutRoot(entry.data.get(), quads[0]); else ASSERT_NOT_REACHED(); didCompleteCurrentRecord(TimelineRecordType::Layout); }
void InspectorTimelineAgent::didEvaluateScript(Frame* frame) { if (frame && m_recordingProfile) { if (m_recordStack.isEmpty()) return; TimelineRecordEntry& entry = m_recordStack.last(); ASSERT(entry.type == TimelineRecordType::EvaluateScript); RefPtr<JSC::Profile> profile = stopProfiling(frame, ASCIILiteral("Timeline EvaluateScript")); if (profile) TimelineRecordFactory::appendProfile(entry.data.get(), profile.release()); m_recordingProfile = false; } didCompleteCurrentRecord(TimelineRecordType::EvaluateScript); }
void InspectorTimelineAgent::didCallFunction(Frame* frame) { if (frame && m_callStackDepth) { --m_callStackDepth; ASSERT(m_callStackDepth >= 0); if (!m_callStackDepth) { if (m_recordStack.isEmpty()) return; TimelineRecordEntry& entry = m_recordStack.last(); ASSERT(entry.type == TimelineRecordType::FunctionCall); RefPtr<JSC::Profile> profile = stopProfiling(frame, ASCIILiteral("Timeline FunctionCall")); if (profile) TimelineRecordFactory::appendProfile(entry.data.get(), profile.release()); } } didCompleteCurrentRecord(TimelineRecordType::FunctionCall); }
void InspectorTimelineAgent::didRecalculateStyle() { didCompleteCurrentRecord(TimelineRecordType::RecalculateStyles); }
void InspectorTimelineAgent::didDispatchEvent() { didCompleteCurrentRecord(TimelineRecordType::EventDispatch); }
void InspectorTimelineAgent::didChangeXHRReadyState() { didCompleteCurrentRecord(XHRReadyStateChangeRecordType); }
void InspectorTimelineAgent::didCallFunction() { didCompleteCurrentRecord(TimelineRecordType::FunctionCall); }
void InspectorTimelineAgent::didScroll() { didCompleteCurrentRecord(TimelineRecordType::ScrollLayer); }
void InspectorTimelineAgent::didDispatchXHRLoadEvent() { didCompleteCurrentRecord(TimelineRecordType::XHRLoad); }
void InspectorTimelineAgent::didFireTimer() { didCompleteCurrentRecord(TimelineRecordType::TimerFire); }
void InspectorTimelineAgent::didComposite() { didCompleteCurrentRecord(TimelineRecordType::CompositeLayers); }
void InspectorTimelineAgent::didResizeImage() { didCompleteCurrentRecord(TimelineRecordType::ResizeImage); }
void InspectorTimelineAgent::didReceiveResourceData() { didCompleteCurrentRecord(ReceiveResourceDataTimelineRecordType); }
void InspectorTimelineAgent::didComposite() { ASSERT(m_startedComposite); didCompleteCurrentRecord(TimelineRecordType::Composite); m_startedComposite = false; }
void InspectorTimelineAgent::didPaint() { didCompleteCurrentRecord(PaintTimelineRecordType); }
void InspectorTimelineAgent::didLoadXHR() { didCompleteCurrentRecord(XHRLoadRecordType); }
void InspectorTimelineAgent::didEvaluateScript() { didCompleteCurrentRecord(TimelineRecordType::EvaluateScript); }
void InspectorTimelineAgent::didLayout() { didCompleteCurrentRecord(LayoutTimelineRecordType); }
void InspectorTimelineAgent::didDispatchXHRReadyStateChangeEvent() { didCompleteCurrentRecord(TimelineRecordType::XHRReadyStateChange); }
void InspectorTimelineAgent::didReceiveResourceResponse() { didCompleteCurrentRecord(TimelineRecordType::ResourceReceiveResponse); }
void InspectorTimelineAgent::didFireAnimationFrame() { didCompleteCurrentRecord(TimelineRecordType::FireAnimationFrame); }
void InspectorTimelineAgent::didProcessTask() { didCompleteCurrentRecord(TimelineRecordType::Program); }