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

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

Issue 59793003: Emit CommitFrame and BeginFrame for impl-side frames (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased on top of TraceEventDispatcher refactoring Created 7 years 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
« no previous file with comments | « Source/core/inspector/InspectorTimelineAgent.h ('k') | Source/core/inspector/TraceEventDispatcher.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorTimelineAgent.cpp
diff --git a/Source/core/inspector/InspectorTimelineAgent.cpp b/Source/core/inspector/InspectorTimelineAgent.cpp
index a7cd43cdda13b02d8cb3e20d0057e5eb966911f7..c808cb05d1012674276019ec7124c5786cc69431 100644
--- a/Source/core/inspector/InspectorTimelineAgent.cpp
+++ b/Source/core/inspector/InspectorTimelineAgent.cpp
@@ -77,7 +77,6 @@ namespace TimelineRecordType {
static const char Program[] = "Program";
static const char EventDispatch[] = "EventDispatch";
-static const char BeginFrame[] = "BeginFrame";
static const char ScheduleStyleRecalculation[] = "ScheduleStyleRecalculation";
static const char RecalculateStyles[] = "RecalculateStyles";
static const char InvalidateLayout[] = "InvalidateLayout";
@@ -125,10 +124,12 @@ static const char WebSocketReceiveHandshakeResponse[] = "WebSocketReceiveHandsha
static const char WebSocketDestroy[] = "WebSocketDestroy";
// Event names visible to other modules.
+const char ActivateLayerTree[] = "ActivateLayerTree";
+const char BeginFrame[] = "BeginFrame";
const char DecodeImage[] = "DecodeImage";
+const char GPUTask[] = "GPUTask";
const char Rasterize[] = "Rasterize";
const char PaintSetup[] = "PaintSetup";
-const char GPUTask[] = "GPUTask";
}
namespace {
@@ -350,11 +351,13 @@ void InspectorTimelineAgent::innerStart()
ScriptGCEvent::addEventListener(this);
if (m_client) {
TraceEventDispatcher* dispatcher = TraceEventDispatcher::instance();
+ dispatcher->addListener(InstrumentationEvents::BeginFrame, TRACE_EVENT_PHASE_INSTANT, this, &InspectorTimelineAgent::onBeginImplSideFrame, m_client);
dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_PHASE_BEGIN, this, &InspectorTimelineAgent::onPaintSetupBegin, m_client);
dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_PHASE_END, this, &InspectorTimelineAgent::onPaintSetupEnd, m_client);
dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_PHASE_BEGIN, this, &InspectorTimelineAgent::onRasterTaskBegin, m_client);
dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_PHASE_END, this, &InspectorTimelineAgent::onRasterTaskEnd, m_client);
dispatcher->addListener(InstrumentationEvents::Layer, TRACE_EVENT_PHASE_DELETE_OBJECT, this, &InspectorTimelineAgent::onLayerDeleted, m_client);
+ dispatcher->addListener(InstrumentationEvents::ActivateLayerTree, TRACE_EVENT_PHASE_INSTANT, this, &InspectorTimelineAgent::onActivateLayerTree, m_client);
dispatcher->addListener(PlatformInstrumentation::ImageDecodeEvent, TRACE_EVENT_PHASE_BEGIN, this, &InspectorTimelineAgent::onImageDecodeBegin, m_client);
dispatcher->addListener(PlatformInstrumentation::ImageDecodeEvent, TRACE_EVENT_PHASE_END, this, &InspectorTimelineAgent::onImageDecodeEnd, m_client);
dispatcher->addListener(PlatformInstrumentation::DrawLazyPixelRefEvent, TRACE_EVENT_PHASE_INSTANT, this, &InspectorTimelineAgent::onDrawLazyPixelRef, m_client);
@@ -885,6 +888,15 @@ void InspectorTimelineAgent::didCloseWebSocket(Document* document, unsigned long
appendRecord(TimelineRecordFactory::createGenericWebSocketData(identifier), TimelineRecordType::WebSocketDestroy, true, document->frame());
}
+void InspectorTimelineAgent::onBeginImplSideFrame(const TraceEventDispatcher::TraceEvent& event)
+{
+ unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments::LayerTreeId);
+ if (layerTreeId != m_layerTreeId)
+ return;
+ TimelineThreadState& state = threadState(event.threadIdentifier());
+ state.recordStack.addInstantRecord(createRecordForEvent(event, TimelineRecordType::BeginFrame));
+}
+
void InspectorTimelineAgent::onPaintSetupBegin(const TraceEventDispatcher::TraceEvent& event)
{
ASSERT(!m_paintSetupStart);
@@ -950,6 +962,16 @@ void InspectorTimelineAgent::onImageDecodeEnd(const TraceEventDispatcher::TraceE
state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp()));
}
+void InspectorTimelineAgent::onActivateLayerTree(const TraceEventDispatcher::TraceEvent& event)
+{
+ unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments::LayerTreeId);
+ if (layerTreeId != m_layerTreeId)
+ return;
+ unsigned long long frameId = event.asUInt(InstrumentationEventArguments::FrameId);
+ TimelineThreadState& state = threadState(event.threadIdentifier());
+ state.recordStack.addInstantRecord(createRecordForEvent(event, TimelineRecordType::ActivateLayerTree, TimelineRecordFactory::createFrameData(frameId)));
+}
+
void InspectorTimelineAgent::onLayerDeleted(const TraceEventDispatcher::TraceEvent& event)
{
unsigned long long id = event.id();
@@ -1209,6 +1231,12 @@ Page* InspectorTimelineAgent::page()
return m_pageAgent ? m_pageAgent->page() : 0;
}
+PassRefPtr<JSONObject> InspectorTimelineAgent::createRecordForEvent(const TraceEventDispatcher::TraceEvent& event, const String& type, PassRefPtr<JSONObject> data)
+{
+ double timeestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp());
+ return TimelineRecordFactory::createBackgroundRecord(timeestamp, String::number(event.threadIdentifier()), type, data);
+}
+
TimelineRecordStack::TimelineRecordStack(InspectorTimelineAgent* timelineAgent)
: m_timelineAgent(timelineAgent)
{
« no previous file with comments | « Source/core/inspector/InspectorTimelineAgent.h ('k') | Source/core/inspector/TraceEventDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698