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

Side by Side Diff: Source/core/inspector/InspectorTimelineAgent.cpp

Issue 46663010: DevTools: Show GPU utilization bar on timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressing comments. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "wtf/CurrentTime.h" 59 #include "wtf/CurrentTime.h"
60 60
61 namespace WebCore { 61 namespace WebCore {
62 62
63 namespace TimelineAgentState { 63 namespace TimelineAgentState {
64 static const char enabled[] = "enabled"; 64 static const char enabled[] = "enabled";
65 static const char started[] = "started"; 65 static const char started[] = "started";
66 static const char startedFromProtocol[] = "startedFromProtocol"; 66 static const char startedFromProtocol[] = "startedFromProtocol";
67 static const char timelineMaxCallStackDepth[] = "timelineMaxCallStackDepth"; 67 static const char timelineMaxCallStackDepth[] = "timelineMaxCallStackDepth";
68 static const char includeDomCounters[] = "includeDomCounters"; 68 static const char includeDomCounters[] = "includeDomCounters";
69 static const char includeGpuEvents[] = "includeGpuEvents";
69 static const char bufferEvents[] = "bufferEvents"; 70 static const char bufferEvents[] = "bufferEvents";
70 } 71 }
71 72
72 // Must be kept in sync with WebInspector.TimelineModel.RecordType in TimelineMo del.js 73 // Must be kept in sync with WebInspector.TimelineModel.RecordType in TimelineMo del.js
73 namespace TimelineRecordType { 74 namespace TimelineRecordType {
74 static const char Program[] = "Program"; 75 static const char Program[] = "Program";
75 76
76 static const char EventDispatch[] = "EventDispatch"; 77 static const char EventDispatch[] = "EventDispatch";
77 static const char BeginFrame[] = "BeginFrame"; 78 static const char BeginFrame[] = "BeginFrame";
78 static const char ScheduleStyleRecalculation[] = "ScheduleStyleRecalculation"; 79 static const char ScheduleStyleRecalculation[] = "ScheduleStyleRecalculation";
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 119
119 static const char WebSocketCreate[] = "WebSocketCreate"; 120 static const char WebSocketCreate[] = "WebSocketCreate";
120 static const char WebSocketSendHandshakeRequest[] = "WebSocketSendHandshakeReque st"; 121 static const char WebSocketSendHandshakeRequest[] = "WebSocketSendHandshakeReque st";
121 static const char WebSocketReceiveHandshakeResponse[] = "WebSocketReceiveHandsha keResponse"; 122 static const char WebSocketReceiveHandshakeResponse[] = "WebSocketReceiveHandsha keResponse";
122 static const char WebSocketDestroy[] = "WebSocketDestroy"; 123 static const char WebSocketDestroy[] = "WebSocketDestroy";
123 124
124 // Event names visible to other modules. 125 // Event names visible to other modules.
125 const char DecodeImage[] = "DecodeImage"; 126 const char DecodeImage[] = "DecodeImage";
126 const char Rasterize[] = "Rasterize"; 127 const char Rasterize[] = "Rasterize";
127 const char PaintSetup[] = "PaintSetup"; 128 const char PaintSetup[] = "PaintSetup";
129 const char GpuTask[] = "GpuTask";
128 } 130 }
129 131
130 namespace { 132 namespace {
131 const char BackendNodeIdGroup[] = "timeline"; 133 const char BackendNodeIdGroup[] = "timeline";
132 const char InternalEventCategory[] = "instrumentation"; 134 const char InternalEventCategory[] = "instrumentation";
133 } 135 }
134 136
135 static Frame* frameForExecutionContext(ExecutionContext* context) 137 static Frame* frameForExecutionContext(ExecutionContext* context)
136 { 138 {
137 Frame* frame = 0; 139 Frame* frame = 0;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 void InspectorTimelineAgent::enable(ErrorString*) 220 void InspectorTimelineAgent::enable(ErrorString*)
219 { 221 {
220 m_state->setBoolean(TimelineAgentState::enabled, true); 222 m_state->setBoolean(TimelineAgentState::enabled, true);
221 } 223 }
222 224
223 void InspectorTimelineAgent::disable(ErrorString*) 225 void InspectorTimelineAgent::disable(ErrorString*)
224 { 226 {
225 m_state->setBoolean(TimelineAgentState::enabled, false); 227 m_state->setBoolean(TimelineAgentState::enabled, false);
226 } 228 }
227 229
228 void InspectorTimelineAgent::start(ErrorString* errorString, const int* maxCallS tackDepth, const bool* bufferEvents, const bool* includeDomCounters) 230 void InspectorTimelineAgent::start(ErrorString* errorString, const int* maxCallS tackDepth, const bool* bufferEvents, const bool* includeDomCounters, const bool* includeGpuEvents)
229 { 231 {
230 if (!m_frontend) 232 if (!m_frontend)
231 return; 233 return;
232 m_state->setBoolean(TimelineAgentState::startedFromProtocol, true); 234 m_state->setBoolean(TimelineAgentState::startedFromProtocol, true);
233 235
234 if (isStarted()) { 236 if (isStarted()) {
235 *errorString = "Timeline is already started"; 237 *errorString = "Timeline is already started";
236 return; 238 return;
237 } 239 }
238 240
239 releaseNodeIds(); 241 releaseNodeIds();
240 if (maxCallStackDepth && *maxCallStackDepth >= 0) 242 if (maxCallStackDepth && *maxCallStackDepth >= 0)
241 m_maxCallStackDepth = *maxCallStackDepth; 243 m_maxCallStackDepth = *maxCallStackDepth;
242 else 244 else
243 m_maxCallStackDepth = 5; 245 m_maxCallStackDepth = 5;
244 246
245 if (bufferEvents && *bufferEvents) 247 if (bufferEvents && *bufferEvents)
246 m_bufferedEvents = TypeBuilder::Array<TypeBuilder::Timeline::TimelineEve nt>::create(); 248 m_bufferedEvents = TypeBuilder::Array<TypeBuilder::Timeline::TimelineEve nt>::create();
247 249
248 m_state->setLong(TimelineAgentState::timelineMaxCallStackDepth, m_maxCallSta ckDepth); 250 m_state->setLong(TimelineAgentState::timelineMaxCallStackDepth, m_maxCallSta ckDepth);
249 m_state->setBoolean(TimelineAgentState::includeDomCounters, includeDomCounte rs && *includeDomCounters); 251 m_state->setBoolean(TimelineAgentState::includeDomCounters, includeDomCounte rs && *includeDomCounters);
252 m_state->setBoolean(TimelineAgentState::includeGpuEvents, includeGpuEvents & & *includeGpuEvents);
250 m_state->setBoolean(TimelineAgentState::bufferEvents, bufferEvents && *buffe rEvents); 253 m_state->setBoolean(TimelineAgentState::bufferEvents, bufferEvents && *buffe rEvents);
251 254
252 innerStart(); 255 innerStart();
253 bool fromConsole = false; 256 bool fromConsole = false;
254 m_frontend->started(&fromConsole); 257 m_frontend->started(&fromConsole);
255 } 258 }
256 259
257 bool InspectorTimelineAgent::isStarted() 260 bool InspectorTimelineAgent::isStarted()
258 { 261 {
259 return m_state->getBoolean(TimelineAgentState::started); 262 return m_state->getBoolean(TimelineAgentState::started);
260 } 263 }
261 264
262 void InspectorTimelineAgent::innerStart() 265 void InspectorTimelineAgent::innerStart()
263 { 266 {
264 m_state->setBoolean(TimelineAgentState::started, true); 267 m_state->setBoolean(TimelineAgentState::started, true);
265 m_timeConverter.reset(); 268 m_timeConverter.reset();
266 m_instrumentingAgents->setInspectorTimelineAgent(this); 269 m_instrumentingAgents->setInspectorTimelineAgent(this);
267 ScriptGCEvent::addEventListener(this); 270 ScriptGCEvent::addEventListener(this);
268 if (m_client && m_pageAgent) 271 if (m_client && m_pageAgent)
269 m_traceEventProcessor = adoptRef(new TimelineTraceEventProcessor(m_weakF actory.createWeakPtr(), m_client)); 272 m_traceEventProcessor = adoptRef(new TimelineTraceEventProcessor(m_weakF actory.createWeakPtr(), m_client, m_state->getBoolean(TimelineAgentState::includ eGpuEvents)));
270 } 273 }
271 274
272 void InspectorTimelineAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder:: Array<TypeBuilder::Timeline::TimelineEvent> >& events) 275 void InspectorTimelineAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder:: Array<TypeBuilder::Timeline::TimelineEvent> >& events)
273 { 276 {
274 m_state->setBoolean(TimelineAgentState::startedFromProtocol, false); 277 m_state->setBoolean(TimelineAgentState::startedFromProtocol, false);
275 m_state->setBoolean(TimelineAgentState::bufferEvents, false); 278 m_state->setBoolean(TimelineAgentState::bufferEvents, false);
276 279
277 if (!isStarted()) { 280 if (!isStarted()) {
278 *errorString = "Timeline was not started"; 281 *errorString = "Timeline was not started";
279 return; 282 return;
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyInc reasingTime()); 956 return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyInc reasingTime());
954 } 957 }
955 958
956 Page* InspectorTimelineAgent::page() 959 Page* InspectorTimelineAgent::page()
957 { 960 {
958 return m_pageAgent ? m_pageAgent->page() : 0; 961 return m_pageAgent ? m_pageAgent->page() : 0;
959 } 962 }
960 963
961 } // namespace WebCore 964 } // namespace WebCore
962 965
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698