Chromium Code Reviews| Index: Source/core/inspector/TimelineTraceEventProcessor.cpp |
| diff --git a/Source/core/inspector/TimelineTraceEventProcessor.cpp b/Source/core/inspector/TimelineTraceEventProcessor.cpp |
| index 4554d1eae93789f0203ba5629f79eacc8fb9ced1..2b9689dafe2abad85c944e1d901d598b1cb26f81 100644 |
| --- a/Source/core/inspector/TimelineTraceEventProcessor.cpp |
| +++ b/Source/core/inspector/TimelineTraceEventProcessor.cpp |
| @@ -177,6 +177,14 @@ TimelineTraceEventProcessor::TimelineTraceEventProcessor(WeakPtr<InspectorTimeli |
| registerHandler(PlatformInstrumentation::ImageDecodeEvent, TRACE_EVENT_PHASE_END, &TimelineTraceEventProcessor::onImageDecodeEnd); |
| registerHandler(PlatformInstrumentation::DrawLazyPixelRefEvent, TRACE_EVENT_PHASE_INSTANT, &TimelineTraceEventProcessor::onDrawLazyPixelRef); |
| registerHandler(PlatformInstrumentation::LazyPixelRef, TRACE_EVENT_PHASE_DELETE_OBJECT, &TimelineTraceEventProcessor::onLazyPixelRefDeleted); |
| + if (m_timelineAgent.get()->isCollectingGpuEvents()) { |
| + // FIXME: Instead of filtering GPU events here on the client side |
| + // just don't enable collection in the GPU process. |
| + // Make sure GPU process agent can handle both client types connected |
| + // simultaneously: ones that need GPU events and ones that do not. |
| + 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.
|
| + registerHandler(InstrumentationEvents::GpuTask, TRACE_EVENT_PHASE_END, &TimelineTraceEventProcessor::onGpuTaskEnd); |
| + } |
| TraceEventDispatcher::instance()->addProcessor(this, m_inspectorClient); |
| } |
| @@ -417,6 +425,24 @@ void TimelineTraceEventProcessor::onLazyPixelRefDeleted(const TraceEvent& event) |
| m_pixelRefToImageInfo.remove(event.id()); |
| } |
| +void TimelineTraceEventProcessor::onGpuTaskBegin(const TraceEvent& event) |
| +{ |
| + RefPtr<JSONObject> data = JSONObject::create(); |
| + 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.
|
| + data->setNumber("ownerPid", event.asUInt(InstrumentationEventArguments::OwnerPid)); |
|
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.
|
| + m_gpuTask = createRecord(event, TimelineRecordType::GPUTask, data); |
| +} |
| + |
| +void TimelineTraceEventProcessor::onGpuTaskEnd(const TraceEvent& event) |
| +{ |
| + InspectorTimelineAgent* timelineAgent = m_timelineAgent.get(); |
| + if (!timelineAgent || !m_gpuTask) |
| + return; |
| + m_gpuTask->setNumber("endTime", m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp())); |
| + timelineAgent->sendEvent(m_gpuTask); |
| + m_gpuTask.clear(); |
| +} |
| + |
| PassRefPtr<JSONObject> TimelineTraceEventProcessor::createRecord(const TraceEvent& event, const String& recordType, PassRefPtr<JSONObject> data) |
| { |
| double startTime = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp()); |