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

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

Issue 307943002: Oilpan: Prepare moving InspectorController and InspectorAgents to oilpan. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 static const char DecodeImage[] = "DecodeImage"; 134 static const char DecodeImage[] = "DecodeImage";
135 static const char GPUTask[] = "GPUTask"; 135 static const char GPUTask[] = "GPUTask";
136 static const char Rasterize[] = "Rasterize"; 136 static const char Rasterize[] = "Rasterize";
137 static const char PaintSetup[] = "PaintSetup"; 137 static const char PaintSetup[] = "PaintSetup";
138 138
139 static const char EmbedderCallback[] = "EmbedderCallback"; 139 static const char EmbedderCallback[] = "EmbedderCallback";
140 } 140 }
141 141
142 using TypeBuilder::Timeline::TimelineEvent; 142 using TypeBuilder::Timeline::TimelineEvent;
143 143
144 class InspectorTimelineAgentTraceEventListener : public TraceEventDispatcher::Tr aceEventListener {
145 public:
146 typedef void (InspectorTimelineAgent::*TraceEventHandlerMethod)(const TraceE ventDispatcher::TraceEvent&);
147 static PassOwnPtrWillBeRawPtr<InspectorTimelineAgentTraceEventListener> crea te(InspectorTimelineAgent* instance, TraceEventHandlerMethod method)
148 {
149 return adoptPtrWillBeNoop(new InspectorTimelineAgentTraceEventListener(i nstance, method));
150 }
151 virtual void call(const TraceEventDispatcher::TraceEvent& event) OVERRIDE
152 {
153 (m_instance->*m_method)(event);
154 }
155 virtual void* target() OVERRIDE
156 {
157 return m_instance;
158 }
159 virtual void trace(Visitor* visitor) OVERRIDE
160 {
161 visitor->trace(m_instance);
162 TraceEventDispatcher::TraceEventListener::trace(visitor);
163 }
164
165 private:
166 InspectorTimelineAgentTraceEventListener(InspectorTimelineAgent* instance, T raceEventHandlerMethod method)
167 : m_instance(instance)
168 , m_method(method)
169 {
170 }
171 RawPtrWillBeMember<InspectorTimelineAgent> m_instance;
172 TraceEventHandlerMethod m_method;
173 };
174
144 struct TimelineRecordEntry { 175 struct TimelineRecordEntry {
145 TimelineRecordEntry(PassRefPtr<TimelineEvent> record, PassRefPtr<JSONObject> data, PassRefPtr<TypeBuilder::Array<TimelineEvent> > children, const String& ty pe) 176 TimelineRecordEntry(PassRefPtr<TimelineEvent> record, PassRefPtr<JSONObject> data, PassRefPtr<TypeBuilder::Array<TimelineEvent> > children, const String& ty pe)
146 : record(record) 177 : record(record)
147 , data(data) 178 , data(data)
148 , children(children) 179 , children(children)
149 , type(type) 180 , type(type)
150 , skipWhenUnbalanced(false) 181 , skipWhenUnbalanced(false)
151 { 182 {
152 } 183 }
153 RefPtr<TimelineEvent> record; 184 RefPtr<TimelineEvent> record;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 addRecordToTimeline(record.release(), time); 285 addRecordToTimeline(record.release(), time);
255 if (m_state->getBoolean(TimelineAgentState::includeCounters)) { 286 if (m_state->getBoolean(TimelineAgentState::includeCounters)) {
256 addRecordToTimeline(createCountersUpdate(), time); 287 addRecordToTimeline(createCountersUpdate(), time);
257 } 288 }
258 } 289 }
259 290
260 InspectorTimelineAgent::~InspectorTimelineAgent() 291 InspectorTimelineAgent::~InspectorTimelineAgent()
261 { 292 {
262 } 293 }
263 294
295 void InspectorTimelineAgent::trace(Visitor* visitor)
296 {
297 visitor->trace(m_pageAgent);
298 visitor->trace(m_layerTreeAgent);
299 InspectorBaseAgent::trace(visitor);
300 }
301
264 void InspectorTimelineAgent::setFrontend(InspectorFrontend* frontend) 302 void InspectorTimelineAgent::setFrontend(InspectorFrontend* frontend)
265 { 303 {
266 m_frontend = frontend->timeline(); 304 m_frontend = frontend->timeline();
267 } 305 }
268 306
269 void InspectorTimelineAgent::clearFrontend() 307 void InspectorTimelineAgent::clearFrontend()
270 { 308 {
271 ErrorString error; 309 ErrorString error;
272 stop(&error); 310 stop(&error);
273 disable(&error); 311 disable(&error);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 381
344 void InspectorTimelineAgent::innerStart() 382 void InspectorTimelineAgent::innerStart()
345 { 383 {
346 if (m_overlay) 384 if (m_overlay)
347 m_overlay->startedRecordingProfile(); 385 m_overlay->startedRecordingProfile();
348 m_state->setBoolean(TimelineAgentState::started, true); 386 m_state->setBoolean(TimelineAgentState::started, true);
349 m_instrumentingAgents->setInspectorTimelineAgent(this); 387 m_instrumentingAgents->setInspectorTimelineAgent(this);
350 ScriptGCEvent::addEventListener(this); 388 ScriptGCEvent::addEventListener(this);
351 if (m_client) { 389 if (m_client) {
352 TraceEventDispatcher* dispatcher = TraceEventDispatcher::instance(); 390 TraceEventDispatcher* dispatcher = TraceEventDispatcher::instance();
353 dispatcher->addListener(InstrumentationEvents::BeginFrame, TRACE_EVENT_P HASE_INSTANT, this, &InspectorTimelineAgent::onBeginImplSideFrame, m_client); 391 dispatcher->addListener(InstrumentationEvents::BeginFrame, TRACE_EVENT_P HASE_INSTANT, InspectorTimelineAgentTraceEventListener::create(this, &InspectorT imelineAgent::onBeginImplSideFrame), m_client);
354 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_BEGIN, this, &InspectorTimelineAgent::onPaintSetupBegin, m_client); 392 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_BEGIN, InspectorTimelineAgentTraceEventListener::create(this, &InspectorTim elineAgent::onPaintSetupBegin), m_client);
355 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_END, this, &InspectorTimelineAgent::onPaintSetupEnd, m_client); 393 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_END, InspectorTimelineAgentTraceEventListener::create(this, &InspectorTimel ineAgent::onPaintSetupEnd), m_client);
356 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_BEGIN, this, &InspectorTimelineAgent::onRasterTaskBegin, m_client); 394 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_BEGIN, InspectorTimelineAgentTraceEventListener::create(this, &InspectorTim elineAgent::onRasterTaskBegin), m_client);
357 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_END, this, &InspectorTimelineAgent::onRasterTaskEnd, m_client); 395 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_END, InspectorTimelineAgentTraceEventListener::create(this, &InspectorTimel ineAgent::onRasterTaskEnd), m_client);
358 dispatcher->addListener(InstrumentationEvents::Layer, TRACE_EVENT_PHASE_ DELETE_OBJECT, this, &InspectorTimelineAgent::onLayerDeleted, m_client); 396 dispatcher->addListener(InstrumentationEvents::Layer, TRACE_EVENT_PHASE_ DELETE_OBJECT, InspectorTimelineAgentTraceEventListener::create(this, &Inspector TimelineAgent::onLayerDeleted), m_client);
359 dispatcher->addListener(InstrumentationEvents::RequestMainThreadFrame, T RACE_EVENT_PHASE_INSTANT, this, &InspectorTimelineAgent::onRequestMainThreadFram e, m_client); 397 dispatcher->addListener(InstrumentationEvents::RequestMainThreadFrame, T RACE_EVENT_PHASE_INSTANT, InspectorTimelineAgentTraceEventListener::create(this, &InspectorTimelineAgent::onRequestMainThreadFrame), m_client);
360 dispatcher->addListener(InstrumentationEvents::ActivateLayerTree, TRACE_ EVENT_PHASE_INSTANT, this, &InspectorTimelineAgent::onActivateLayerTree, m_clien t); 398 dispatcher->addListener(InstrumentationEvents::ActivateLayerTree, TRACE_ EVENT_PHASE_INSTANT, InspectorTimelineAgentTraceEventListener::create(this, &Ins pectorTimelineAgent::onActivateLayerTree), m_client);
361 dispatcher->addListener(InstrumentationEvents::DrawFrame, TRACE_EVENT_PH ASE_INSTANT, this, &InspectorTimelineAgent::onDrawFrame, m_client); 399 dispatcher->addListener(InstrumentationEvents::DrawFrame, TRACE_EVENT_PH ASE_INSTANT, InspectorTimelineAgentTraceEventListener::create(this, &InspectorTi melineAgent::onDrawFrame), m_client);
362 dispatcher->addListener(PlatformInstrumentation::ImageDecodeEvent, TRACE _EVENT_PHASE_BEGIN, this, &InspectorTimelineAgent::onImageDecodeBegin, m_client) ; 400 dispatcher->addListener(PlatformInstrumentation::ImageDecodeEvent, TRACE _EVENT_PHASE_BEGIN, InspectorTimelineAgentTraceEventListener::create(this, &Insp ectorTimelineAgent::onImageDecodeBegin), m_client);
363 dispatcher->addListener(PlatformInstrumentation::ImageDecodeEvent, TRACE _EVENT_PHASE_END, this, &InspectorTimelineAgent::onImageDecodeEnd, m_client); 401 dispatcher->addListener(PlatformInstrumentation::ImageDecodeEvent, TRACE _EVENT_PHASE_END, InspectorTimelineAgentTraceEventListener::create(this, &Inspec torTimelineAgent::onImageDecodeEnd), m_client);
364 dispatcher->addListener(PlatformInstrumentation::DrawLazyPixelRefEvent, TRACE_EVENT_PHASE_INSTANT, this, &InspectorTimelineAgent::onDrawLazyPixelRef, m_ client); 402 dispatcher->addListener(PlatformInstrumentation::DrawLazyPixelRefEvent, TRACE_EVENT_PHASE_INSTANT, InspectorTimelineAgentTraceEventListener::create(this , &InspectorTimelineAgent::onDrawLazyPixelRef), m_client);
365 dispatcher->addListener(PlatformInstrumentation::DecodeLazyPixelRefEvent , TRACE_EVENT_PHASE_BEGIN, this, &InspectorTimelineAgent::onDecodeLazyPixelRefBe gin, m_client); 403 dispatcher->addListener(PlatformInstrumentation::DecodeLazyPixelRefEvent , TRACE_EVENT_PHASE_BEGIN, InspectorTimelineAgentTraceEventListener::create(this , &InspectorTimelineAgent::onDecodeLazyPixelRefBegin), m_client);
366 dispatcher->addListener(PlatformInstrumentation::DecodeLazyPixelRefEvent , TRACE_EVENT_PHASE_END, this, &InspectorTimelineAgent::onDecodeLazyPixelRefEnd, m_client); 404 dispatcher->addListener(PlatformInstrumentation::DecodeLazyPixelRefEvent , TRACE_EVENT_PHASE_END, InspectorTimelineAgentTraceEventListener::create(this, &InspectorTimelineAgent::onDecodeLazyPixelRefEnd), m_client);
367 dispatcher->addListener(PlatformInstrumentation::LazyPixelRef, TRACE_EVE NT_PHASE_DELETE_OBJECT, this, &InspectorTimelineAgent::onLazyPixelRefDeleted, m_ client); 405 dispatcher->addListener(PlatformInstrumentation::LazyPixelRef, TRACE_EVE NT_PHASE_DELETE_OBJECT, InspectorTimelineAgentTraceEventListener::create(this, & InspectorTimelineAgent::onLazyPixelRefDeleted), m_client);
368 dispatcher->addListener(InstrumentationEvents::EmbedderCallback, TRACE_E VENT_PHASE_BEGIN, this, &InspectorTimelineAgent::onEmbedderCallbackBegin, m_clie nt); 406 dispatcher->addListener(InstrumentationEvents::EmbedderCallback, TRACE_E VENT_PHASE_BEGIN, InspectorTimelineAgentTraceEventListener::create(this, &Inspec torTimelineAgent::onEmbedderCallbackBegin), m_client);
369 dispatcher->addListener(InstrumentationEvents::EmbedderCallback, TRACE_E VENT_PHASE_END, this, &InspectorTimelineAgent::onEmbedderCallbackEnd, m_client); 407 dispatcher->addListener(InstrumentationEvents::EmbedderCallback, TRACE_E VENT_PHASE_END, InspectorTimelineAgentTraceEventListener::create(this, &Inspecto rTimelineAgent::onEmbedderCallbackEnd), m_client);
370 408
371 if (m_state->getBoolean(TimelineAgentState::includeGPUEvents)) { 409 if (m_state->getBoolean(TimelineAgentState::includeGPUEvents)) {
372 m_pendingGPURecord.clear(); 410 m_pendingGPURecord.clear();
373 m_client->startGPUEventsRecording(); 411 m_client->startGPUEventsRecording();
374 } 412 }
375 } 413 }
376 } 414 }
377 415
378 void InspectorTimelineAgent::stop(ErrorString* errorString) 416 void InspectorTimelineAgent::stop(ErrorString* errorString)
379 { 417 {
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 1341
1304 #if ENABLE(ASSERT) 1342 #if ENABLE(ASSERT)
1305 bool TimelineRecordStack::isOpenRecordOfType(const String& type) 1343 bool TimelineRecordStack::isOpenRecordOfType(const String& type)
1306 { 1344 {
1307 return !m_stack.isEmpty() && m_stack.last().type == type; 1345 return !m_stack.isEmpty() && m_stack.last().type == type;
1308 } 1346 }
1309 #endif 1347 #endif
1310 1348
1311 } // namespace blink 1349 } // namespace blink
1312 1350
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorTimelineAgent.h ('k') | Source/core/inspector/InspectorTracingAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698