Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1218)

Unified Diff: Source/core/inspector/TimelineTraceEventProcessor.cpp

Issue 91183002: Timeline: do not rely on UpdateLayer & PaintLayer trace events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: re-upload Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/TimelineTraceEventProcessor.cpp
diff --git a/Source/core/inspector/TimelineTraceEventProcessor.cpp b/Source/core/inspector/TimelineTraceEventProcessor.cpp
index ea0aae2d6cb298a4e1a448411310fdc2692bb8d2..a741c4aca49215c12b36aaed2d4504d87046dd42 100644
--- a/Source/core/inspector/TimelineTraceEventProcessor.cpp
+++ b/Source/core/inspector/TimelineTraceEventProcessor.cpp
@@ -156,15 +156,10 @@ TimelineTraceEventProcessor::TimelineTraceEventProcessor(WeakPtr<InspectorTimeli
, m_layerTreeId(m_timelineAgent.get()->layerTreeId())
, m_lastEventProcessingTime(0)
, m_processEventsTaskInFlight(false)
- , m_layerId(0)
, m_paintSetupStart(0)
, m_paintSetupEnd(0)
{
registerHandler(InstrumentationEvents::BeginFrame, TRACE_EVENT_PHASE_INSTANT, &TimelineTraceEventProcessor::onBeginFrame);
- registerHandler(InstrumentationEvents::UpdateLayer, TRACE_EVENT_PHASE_BEGIN, &TimelineTraceEventProcessor::onUpdateLayerBegin);
- registerHandler(InstrumentationEvents::UpdateLayer, TRACE_EVENT_PHASE_END, &TimelineTraceEventProcessor::onUpdateLayerEnd);
- registerHandler(InstrumentationEvents::PaintLayer, TRACE_EVENT_PHASE_BEGIN, &TimelineTraceEventProcessor::onPaintLayerBegin);
- registerHandler(InstrumentationEvents::PaintLayer, TRACE_EVENT_PHASE_END, &TimelineTraceEventProcessor::onPaintLayerEnd);
registerHandler(InstrumentationEvents::PaintSetup, TRACE_EVENT_PHASE_BEGIN, &TimelineTraceEventProcessor::onPaintSetupBegin);
registerHandler(InstrumentationEvents::PaintSetup, TRACE_EVENT_PHASE_END, &TimelineTraceEventProcessor::onPaintSetupEnd);
registerHandler(InstrumentationEvents::RasterTask, TRACE_EVENT_PHASE_BEGIN, &TimelineTraceEventProcessor::onRasterTaskBegin);
@@ -246,35 +241,6 @@ void TimelineTraceEventProcessor::onBeginFrame(const TraceEvent&)
// as this is only done upon events we recognize.
}
-void TimelineTraceEventProcessor::onUpdateLayerBegin(const TraceEvent& event)
-{
- unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments::LayerTreeId);
- if (layerTreeId != static_cast<unsigned long long>(m_layerTreeId))
- return;
- m_layerId = event.asUInt(InstrumentationEventArguments::LayerId);
- // We don't know the node yet. For content layers, the node will be updated
- // by paint. For others, let it remain 0 -- we just need the fact that
- // the layer belongs to the page (see cookie check).
- m_layerToNodeMap.add(m_layerId, 0);
-}
-
-void TimelineTraceEventProcessor::onUpdateLayerEnd(const TraceEvent& event)
-{
- m_layerId = 0;
-}
-
-void TimelineTraceEventProcessor::onPaintLayerBegin(const TraceEvent& event)
-{
- m_layerId = event.asUInt(InstrumentationEventArguments::LayerId);
- ASSERT(m_layerId);
- ASSERT(!m_paintSetupStart);
-}
-
-void TimelineTraceEventProcessor::onPaintLayerEnd(const TraceEvent& event)
-{
- m_layerId = 0;
-}
-
void TimelineTraceEventProcessor::onPaintSetupBegin(const TraceEvent& event)
{
ASSERT(!m_paintSetupStart);
@@ -362,20 +328,22 @@ void TimelineTraceEventProcessor::onPaint(const TraceEvent& event)
{
double paintSetupStart = m_paintSetupStart;
m_paintSetupStart = 0;
- if (!m_layerId)
- return;
unsigned long long pageId = event.asUInt(InstrumentationEventArguments::PageId);
if (pageId != m_pageId)
return;
- long long nodeId = event.asInt(InstrumentationEventArguments::NodeId);
- ASSERT(nodeId);
- m_layerToNodeMap.set(m_layerId, nodeId);
InspectorTimelineAgent* timelineAgent = m_timelineAgent.get();
- if (timelineAgent && paintSetupStart) {
- RefPtr<JSONObject> paintSetupRecord = TimelineRecordFactory::createGenericRecord(paintSetupStart, 0, TimelineRecordType::PaintSetup);
- paintSetupRecord->setNumber("endTime", m_paintSetupEnd);
- paintSetupRecord->setObject("data", TimelineRecordFactory::createLayerData(nodeId));
- timelineAgent->addRecordToTimeline(paintSetupRecord);
+ if (!timelineAgent)
+ return;
+ if (int layerId = timelineAgent->layerBeingPainted()) {
+ int nodeId = timelineAgent->nodeBeingPainted();
+ ASSERT(nodeId);
+ m_layerToNodeMap.set(layerId, nodeId);
+ if (paintSetupStart) {
+ RefPtr<JSONObject> paintSetupRecord = TimelineRecordFactory::createGenericRecord(paintSetupStart, 0, TimelineRecordType::PaintSetup);
+ paintSetupRecord->setNumber("endTime", m_paintSetupEnd);
+ paintSetupRecord->setObject("data", TimelineRecordFactory::createLayerData(nodeId));
+ timelineAgent->addRecordToTimeline(paintSetupRecord);
+ }
}
}
@@ -396,9 +364,6 @@ void TimelineTraceEventProcessor::onDecodeLazyPixelRefEnd(const TraceEvent& even
void TimelineTraceEventProcessor::onDrawLazyPixelRef(const TraceEvent& event)
{
- // Only track LazyPixelRefs created while we paint known layers
- if (!m_layerId || !m_layerToNodeMap.contains(m_layerId))
- return;
unsigned long long pixelRefId = event.asUInt(PlatformInstrumentation::LazyPixelRef);
ASSERT(pixelRefId);
InspectorTimelineAgent* timelineAgent = m_timelineAgent.get();
« no previous file with comments | « Source/core/inspector/TimelineTraceEventProcessor.h ('k') | Source/core/rendering/CompositedLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698