OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 339 |
340 bool InspectorTimelineAgent::isStarted() | 340 bool InspectorTimelineAgent::isStarted() |
341 { | 341 { |
342 return m_state->getBoolean(TimelineAgentState::started); | 342 return m_state->getBoolean(TimelineAgentState::started); |
343 } | 343 } |
344 | 344 |
345 void InspectorTimelineAgent::innerStart() | 345 void InspectorTimelineAgent::innerStart() |
346 { | 346 { |
347 if (m_overlay) | 347 if (m_overlay) |
348 m_overlay->startedRecordingProfile(); | 348 m_overlay->startedRecordingProfile(); |
| 349 m_registry->profilerStarted(); |
349 m_state->setBoolean(TimelineAgentState::started, true); | 350 m_state->setBoolean(TimelineAgentState::started, true); |
350 m_instrumentingAgents->setInspectorTimelineAgent(this); | 351 m_instrumentingAgents->setInspectorTimelineAgent(this); |
351 ScriptGCEvent::addEventListener(this); | 352 ScriptGCEvent::addEventListener(this); |
352 if (m_client) { | 353 if (m_client) { |
353 TraceEventDispatcher* dispatcher = TraceEventDispatcher::instance(); | 354 TraceEventDispatcher* dispatcher = TraceEventDispatcher::instance(); |
354 dispatcher->addListener(InstrumentationEvents::BeginFrame, TRACE_EVENT_P
HASE_INSTANT, this, &InspectorTimelineAgent::onBeginImplSideFrame, m_client); | 355 dispatcher->addListener(InstrumentationEvents::BeginFrame, TRACE_EVENT_P
HASE_INSTANT, this, &InspectorTimelineAgent::onBeginImplSideFrame, m_client); |
355 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P
HASE_BEGIN, this, &InspectorTimelineAgent::onPaintSetupBegin, m_client); | 356 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P
HASE_BEGIN, this, &InspectorTimelineAgent::onPaintSetupBegin, m_client); |
356 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P
HASE_END, this, &InspectorTimelineAgent::onPaintSetupEnd, m_client); | 357 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P
HASE_END, this, &InspectorTimelineAgent::onPaintSetupEnd, m_client); |
357 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P
HASE_BEGIN, this, &InspectorTimelineAgent::onRasterTaskBegin, m_client); | 358 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P
HASE_BEGIN, this, &InspectorTimelineAgent::onRasterTaskBegin, m_client); |
358 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P
HASE_END, this, &InspectorTimelineAgent::onRasterTaskEnd, m_client); | 359 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P
HASE_END, this, &InspectorTimelineAgent::onRasterTaskEnd, m_client); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 void InspectorTimelineAgent::innerStop(bool fromConsole) | 396 void InspectorTimelineAgent::innerStop(bool fromConsole) |
396 { | 397 { |
397 m_state->setBoolean(TimelineAgentState::started, false); | 398 m_state->setBoolean(TimelineAgentState::started, false); |
398 | 399 |
399 if (m_client) { | 400 if (m_client) { |
400 TraceEventDispatcher::instance()->removeAllListeners(this, m_client); | 401 TraceEventDispatcher::instance()->removeAllListeners(this, m_client); |
401 if (m_state->getBoolean(TimelineAgentState::includeGPUEvents)) | 402 if (m_state->getBoolean(TimelineAgentState::includeGPUEvents)) |
402 m_client->stopGPUEventsRecording(); | 403 m_client->stopGPUEventsRecording(); |
403 } | 404 } |
404 m_instrumentingAgents->setInspectorTimelineAgent(0); | 405 m_instrumentingAgents->setInspectorTimelineAgent(0); |
| 406 m_registry->profilerStopped(); |
405 ScriptGCEvent::removeEventListener(this); | 407 ScriptGCEvent::removeEventListener(this); |
406 | 408 |
407 clearRecordStack(); | 409 clearRecordStack(); |
408 m_threadStates.clear(); | 410 m_threadStates.clear(); |
409 m_gpuTask.clear(); | 411 m_gpuTask.clear(); |
410 m_layerToNodeMap.clear(); | 412 m_layerToNodeMap.clear(); |
411 m_pixelRefToImageInfo.clear(); | 413 m_pixelRefToImageInfo.clear(); |
412 m_imageBeingPainted = 0; | 414 m_imageBeingPainted = 0; |
413 m_paintSetupStart = 0; | 415 m_paintSetupStart = 0; |
414 m_mayEmitFirstPaint = false; | 416 m_mayEmitFirstPaint = false; |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 | 1142 |
1141 void InspectorTimelineAgent::unwindRecordStack() | 1143 void InspectorTimelineAgent::unwindRecordStack() |
1142 { | 1144 { |
1143 while (!m_recordStack.isEmpty()) { | 1145 while (!m_recordStack.isEmpty()) { |
1144 TimelineRecordEntry& entry = m_recordStack.last(); | 1146 TimelineRecordEntry& entry = m_recordStack.last(); |
1145 didCompleteCurrentRecord(entry.type); | 1147 didCompleteCurrentRecord(entry.type); |
1146 } | 1148 } |
1147 } | 1149 } |
1148 | 1150 |
1149 InspectorTimelineAgent::InspectorTimelineAgent(InspectorPageAgent* pageAgent, In
spectorLayerTreeAgent* layerTreeAgent, | 1151 InspectorTimelineAgent::InspectorTimelineAgent(InspectorPageAgent* pageAgent, In
spectorLayerTreeAgent* layerTreeAgent, |
1150 InspectorOverlay* overlay, InspectorType type, InspectorClient* client) | 1152 InspectorOverlay* overlay, InspectorType type, InspectorClient* client, Insp
ectorAgentRegistry* registry) |
1151 : InspectorBaseAgent<InspectorTimelineAgent>("Timeline") | 1153 : InspectorBaseAgent<InspectorTimelineAgent>("Timeline") |
1152 , m_pageAgent(pageAgent) | 1154 , m_pageAgent(pageAgent) |
1153 , m_layerTreeAgent(layerTreeAgent) | 1155 , m_layerTreeAgent(layerTreeAgent) |
1154 , m_frontend(0) | 1156 , m_frontend(0) |
1155 , m_client(client) | 1157 , m_client(client) |
1156 , m_overlay(overlay) | 1158 , m_overlay(overlay) |
1157 , m_inspectorType(type) | 1159 , m_inspectorType(type) |
1158 , m_id(1) | 1160 , m_id(1) |
1159 , m_layerTreeId(0) | 1161 , m_layerTreeId(0) |
1160 , m_maxCallStackDepth(5) | 1162 , m_maxCallStackDepth(5) |
1161 , m_platformInstrumentationClientInstalledAtStackDepth(0) | 1163 , m_platformInstrumentationClientInstalledAtStackDepth(0) |
1162 , m_imageBeingPainted(0) | 1164 , m_imageBeingPainted(0) |
1163 , m_paintSetupStart(0) | 1165 , m_paintSetupStart(0) |
1164 , m_mayEmitFirstPaint(false) | 1166 , m_mayEmitFirstPaint(false) |
1165 , m_lastProgressTimestamp(0) | 1167 , m_lastProgressTimestamp(0) |
| 1168 , m_registry(registry) |
1166 { | 1169 { |
1167 } | 1170 } |
1168 | 1171 |
1169 void InspectorTimelineAgent::appendRecord(PassRefPtr<JSONObject> data, const Str
ing& type, bool captureCallStack, LocalFrame* frame) | 1172 void InspectorTimelineAgent::appendRecord(PassRefPtr<JSONObject> data, const Str
ing& type, bool captureCallStack, LocalFrame* frame) |
1170 { | 1173 { |
1171 double ts = timestamp(); | 1174 double ts = timestamp(); |
1172 RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecord(ts
, captureCallStack ? m_maxCallStackDepth : 0, type, data); | 1175 RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecord(ts
, captureCallStack ? m_maxCallStackDepth : 0, type, data); |
1173 setFrameIdentifier(record.get(), frame); | 1176 setFrameIdentifier(record.get(), frame); |
1174 addRecordToTimeline(record.release(), ts); | 1177 addRecordToTimeline(record.release(), ts); |
1175 } | 1178 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 | 1308 |
1306 #ifndef NDEBUG | 1309 #ifndef NDEBUG |
1307 bool TimelineRecordStack::isOpenRecordOfType(const String& type) | 1310 bool TimelineRecordStack::isOpenRecordOfType(const String& type) |
1308 { | 1311 { |
1309 return !m_stack.isEmpty() && m_stack.last().type == type; | 1312 return !m_stack.isEmpty() && m_stack.last().type == type; |
1310 } | 1313 } |
1311 #endif | 1314 #endif |
1312 | 1315 |
1313 } // namespace WebCore | 1316 } // namespace WebCore |
1314 | 1317 |
OLD | NEW |