| 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); |
| 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 unsigned ownerPID = event.asUInt(InstrumentationEventArguments::OwnerPID); |
| 432 m_gpuTask = createRecord(event, TimelineRecordType::GPUTask, TimelineRecordF
actory::createGPUTaskData(ownerPID)); |
| 433 } |
| 434 |
| 435 void TimelineTraceEventProcessor::onGPUTaskEnd(const TraceEvent& event) |
| 436 { |
| 437 InspectorTimelineAgent* timelineAgent = m_timelineAgent.get(); |
| 438 if (!timelineAgent || !m_gpuTask) |
| 439 return; |
| 440 m_gpuTask->setNumber("endTime", m_timeConverter.fromMonotonicallyIncreasingT
ime(event.timestamp())); |
| 441 timelineAgent->sendEvent(m_gpuTask); |
| 442 m_gpuTask.clear(); |
| 443 } |
| 444 |
| 420 PassRefPtr<JSONObject> TimelineTraceEventProcessor::createRecord(const TraceEven
t& event, const String& recordType, PassRefPtr<JSONObject> data) | 445 PassRefPtr<JSONObject> TimelineTraceEventProcessor::createRecord(const TraceEven
t& event, const String& recordType, PassRefPtr<JSONObject> data) |
| 421 { | 446 { |
| 422 double startTime = m_timeConverter.fromMonotonicallyIncreasingTime(event.tim
estamp()); | 447 double startTime = m_timeConverter.fromMonotonicallyIncreasingTime(event.tim
estamp()); |
| 423 RefPtr<JSONObject> record = TimelineRecordFactory::createBackgroundRecord(st
artTime, String::number(event.threadIdentifier())); | 448 RefPtr<JSONObject> record = TimelineRecordFactory::createBackgroundRecord(st
artTime, String::number(event.threadIdentifier())); |
| 424 record->setString("type", recordType); | 449 record->setString("type", recordType); |
| 425 record->setObject("data", data ? data : JSONObject::create()); | 450 record->setObject("data", data ? data : JSONObject::create()); |
| 426 return record.release(); | 451 return record.release(); |
| 427 } | 452 } |
| 428 | 453 |
| 429 void TimelineTraceEventProcessor::processBackgroundEvents() | 454 void TimelineTraceEventProcessor::processBackgroundEvents() |
| (...skipping 17 matching lines...) Expand all Loading... |
| 447 } | 472 } |
| 448 | 473 |
| 449 void TimelineTraceEventProcessor::processBackgroundEventsTask() | 474 void TimelineTraceEventProcessor::processBackgroundEventsTask() |
| 450 { | 475 { |
| 451 m_processEventsTaskInFlight = false; | 476 m_processEventsTaskInFlight = false; |
| 452 processBackgroundEvents(); | 477 processBackgroundEvents(); |
| 453 } | 478 } |
| 454 | 479 |
| 455 } // namespace WebCore | 480 } // namespace WebCore |
| 456 | 481 |
| OLD | NEW |