Chromium Code Reviews| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 registerHandler(InstrumentationEvents::RasterTask, TRACE_EVENT_PHASE_BEGIN, &TimelineTraceEventProcessor::onRasterTaskBegin); | 170 registerHandler(InstrumentationEvents::RasterTask, TRACE_EVENT_PHASE_BEGIN, &TimelineTraceEventProcessor::onRasterTaskBegin); |
| 171 registerHandler(InstrumentationEvents::RasterTask, TRACE_EVENT_PHASE_END, &T imelineTraceEventProcessor::onRasterTaskEnd); | 171 registerHandler(InstrumentationEvents::RasterTask, TRACE_EVENT_PHASE_END, &T imelineTraceEventProcessor::onRasterTaskEnd); |
| 172 registerHandler(InstrumentationEvents::ImageDecodeTask, TRACE_EVENT_PHASE_BE GIN, &TimelineTraceEventProcessor::onImageDecodeTaskBegin); | 172 registerHandler(InstrumentationEvents::ImageDecodeTask, TRACE_EVENT_PHASE_BE GIN, &TimelineTraceEventProcessor::onImageDecodeTaskBegin); |
| 173 registerHandler(InstrumentationEvents::ImageDecodeTask, TRACE_EVENT_PHASE_EN D, &TimelineTraceEventProcessor::onImageDecodeTaskEnd); | 173 registerHandler(InstrumentationEvents::ImageDecodeTask, TRACE_EVENT_PHASE_EN D, &TimelineTraceEventProcessor::onImageDecodeTaskEnd); |
| 174 registerHandler(InstrumentationEvents::Layer, TRACE_EVENT_PHASE_DELETE_OBJEC T, &TimelineTraceEventProcessor::onLayerDeleted); | 174 registerHandler(InstrumentationEvents::Layer, TRACE_EVENT_PHASE_DELETE_OBJEC T, &TimelineTraceEventProcessor::onLayerDeleted); |
| 175 registerHandler(InstrumentationEvents::Paint, TRACE_EVENT_PHASE_INSTANT, &Ti melineTraceEventProcessor::onPaint); | 175 registerHandler(InstrumentationEvents::Paint, TRACE_EVENT_PHASE_INSTANT, &Ti melineTraceEventProcessor::onPaint); |
| 176 registerHandler(PlatformInstrumentation::ImageDecodeEvent, TRACE_EVENT_PHASE _BEGIN, &TimelineTraceEventProcessor::onImageDecodeBegin); | 176 registerHandler(PlatformInstrumentation::ImageDecodeEvent, TRACE_EVENT_PHASE _BEGIN, &TimelineTraceEventProcessor::onImageDecodeBegin); |
| 177 registerHandler(PlatformInstrumentation::ImageDecodeEvent, TRACE_EVENT_PHASE _END, &TimelineTraceEventProcessor::onImageDecodeEnd); | 177 registerHandler(PlatformInstrumentation::ImageDecodeEvent, TRACE_EVENT_PHASE _END, &TimelineTraceEventProcessor::onImageDecodeEnd); |
| 178 registerHandler(PlatformInstrumentation::DrawLazyPixelRefEvent, TRACE_EVENT_ PHASE_INSTANT, &TimelineTraceEventProcessor::onDrawLazyPixelRef); | 178 registerHandler(PlatformInstrumentation::DrawLazyPixelRefEvent, TRACE_EVENT_ PHASE_INSTANT, &TimelineTraceEventProcessor::onDrawLazyPixelRef); |
| 179 registerHandler(PlatformInstrumentation::LazyPixelRef, TRACE_EVENT_PHASE_DEL ETE_OBJECT, &TimelineTraceEventProcessor::onLazyPixelRefDeleted); | 179 registerHandler(PlatformInstrumentation::LazyPixelRef, TRACE_EVENT_PHASE_DEL ETE_OBJECT, &TimelineTraceEventProcessor::onLazyPixelRefDeleted); |
| 180 if (m_timelineAgent.get()->isCollectingGpuEvents()) { | |
| 181 // FIXME: Instead of filtering GPU events here on the client side | |
| 182 // just don't enable collection in the GPU process. | |
| 183 // Make sure GPU process agent can handle both client types connected | |
| 184 // simultaneously: ones that need GPU events and ones that do not. | |
| 185 registerHandler(InstrumentationEvents::GpuTask, TRACE_EVENT_PHASE_BEGIN, &TimelineTraceEventProcessor::onGpuTaskBegin); | |
|
caseq
2013/11/05 14:26:58
How about s/Gpu/GPU/ globally on the patch?
alph
2013/11/05 14:59:16
I'd like to keep it as "Gpu" taking into account o
alph
2013/11/05 18:28:58
Done.
| |
| 186 registerHandler(InstrumentationEvents::GpuTask, TRACE_EVENT_PHASE_END, & TimelineTraceEventProcessor::onGpuTaskEnd); | |
| 187 } | |
| 180 | 188 |
| 181 TraceEventDispatcher::instance()->addProcessor(this, m_inspectorClient); | 189 TraceEventDispatcher::instance()->addProcessor(this, m_inspectorClient); |
| 182 } | 190 } |
| 183 | 191 |
| 184 TimelineTraceEventProcessor::~TimelineTraceEventProcessor() | 192 TimelineTraceEventProcessor::~TimelineTraceEventProcessor() |
| 185 { | 193 { |
| 186 } | 194 } |
| 187 | 195 |
| 188 void TimelineTraceEventProcessor::registerHandler(const char* name, char phase, TraceEventHandler handler) | 196 void TimelineTraceEventProcessor::registerHandler(const char* name, char phase, TraceEventHandler handler) |
| 189 { | 197 { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 if (const ImageResource* resource = renderImage->cachedImage()) | 418 if (const ImageResource* resource = renderImage->cachedImage()) |
| 411 url = resource->url().string(); | 419 url = resource->url().string(); |
| 412 m_pixelRefToImageInfo.set(pixelRefId, ImageInfo(nodeId, url)); | 420 m_pixelRefToImageInfo.set(pixelRefId, ImageInfo(nodeId, url)); |
| 413 } | 421 } |
| 414 | 422 |
| 415 void TimelineTraceEventProcessor::onLazyPixelRefDeleted(const TraceEvent& event) | 423 void TimelineTraceEventProcessor::onLazyPixelRefDeleted(const TraceEvent& event) |
| 416 { | 424 { |
| 417 m_pixelRefToImageInfo.remove(event.id()); | 425 m_pixelRefToImageInfo.remove(event.id()); |
| 418 } | 426 } |
| 419 | 427 |
| 428 void TimelineTraceEventProcessor::onGpuTaskBegin(const TraceEvent& event) | |
| 429 { | |
| 430 RefPtr<JSONObject> data = JSONObject::create(); | |
| 431 data->setString("name", event.name()); | |
|
caseq
2013/11/05 14:26:58
Do we really want to expose this?
alph
2013/11/05 14:59:16
not really. nuked.
| |
| 432 data->setNumber("ownerPid", event.asUInt(InstrumentationEventArguments::Owne rPid)); | |
|
caseq
2013/11/05 14:26:58
Please extract the above lines into a TimelineReco
alph
2013/11/05 14:59:16
The record creation is quite simple already. Also
alph
2013/11/05 18:28:58
Done.
| |
| 433 m_gpuTask = createRecord(event, TimelineRecordType::GPUTask, data); | |
| 434 } | |
| 435 | |
| 436 void TimelineTraceEventProcessor::onGpuTaskEnd(const TraceEvent& event) | |
| 437 { | |
| 438 InspectorTimelineAgent* timelineAgent = m_timelineAgent.get(); | |
| 439 if (!timelineAgent || !m_gpuTask) | |
| 440 return; | |
| 441 m_gpuTask->setNumber("endTime", m_timeConverter.fromMonotonicallyIncreasingT ime(event.timestamp())); | |
| 442 timelineAgent->sendEvent(m_gpuTask); | |
| 443 m_gpuTask.clear(); | |
| 444 } | |
| 445 | |
| 420 PassRefPtr<JSONObject> TimelineTraceEventProcessor::createRecord(const TraceEven t& event, const String& recordType, PassRefPtr<JSONObject> data) | 446 PassRefPtr<JSONObject> TimelineTraceEventProcessor::createRecord(const TraceEven t& event, const String& recordType, PassRefPtr<JSONObject> data) |
| 421 { | 447 { |
| 422 double startTime = m_timeConverter.fromMonotonicallyIncreasingTime(event.tim estamp()); | 448 double startTime = m_timeConverter.fromMonotonicallyIncreasingTime(event.tim estamp()); |
| 423 RefPtr<JSONObject> record = TimelineRecordFactory::createBackgroundRecord(st artTime, String::number(event.threadIdentifier())); | 449 RefPtr<JSONObject> record = TimelineRecordFactory::createBackgroundRecord(st artTime, String::number(event.threadIdentifier())); |
| 424 record->setString("type", recordType); | 450 record->setString("type", recordType); |
| 425 record->setObject("data", data ? data : JSONObject::create()); | 451 record->setObject("data", data ? data : JSONObject::create()); |
| 426 return record.release(); | 452 return record.release(); |
| 427 } | 453 } |
| 428 | 454 |
| 429 void TimelineTraceEventProcessor::processBackgroundEvents() | 455 void TimelineTraceEventProcessor::processBackgroundEvents() |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 447 } | 473 } |
| 448 | 474 |
| 449 void TimelineTraceEventProcessor::processBackgroundEventsTask() | 475 void TimelineTraceEventProcessor::processBackgroundEventsTask() |
| 450 { | 476 { |
| 451 m_processEventsTaskInFlight = false; | 477 m_processEventsTaskInFlight = false; |
| 452 processBackgroundEvents(); | 478 processBackgroundEvents(); |
| 453 } | 479 } |
| 454 | 480 |
| 455 } // namespace WebCore | 481 } // namespace WebCore |
| 456 | 482 |
| OLD | NEW |