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

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

Issue 14741014: Timeline: add reference to root node of layer in Rasterize event (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 void TimelineTraceEventProcessor::onPaintLayerEnd(const TraceEvent&) 236 void TimelineTraceEventProcessor::onPaintLayerEnd(const TraceEvent&)
237 { 237 {
238 m_layerId = 0; 238 m_layerId = 0;
239 } 239 }
240 240
241 void TimelineTraceEventProcessor::onRasterTaskBegin(const TraceEvent& event) 241 void TimelineTraceEventProcessor::onRasterTaskBegin(const TraceEvent& event)
242 { 242 {
243 TimelineThreadState& state = threadState(event.threadIdentifier()); 243 TimelineThreadState& state = threadState(event.threadIdentifier());
244 if (!maybeEnterLayerTask(event, state)) 244 if (!maybeEnterLayerTask(event, state))
245 return; 245 return;
246 unsigned long long layerId = event.asUInt(InstrumentationEventArguments::Lay erId);
247 ASSERT(layerId);
246 RefPtr<InspectorObject> record = createRecord(event, TimelineRecordType::Ras terize); 248 RefPtr<InspectorObject> record = createRecord(event, TimelineRecordType::Ras terize);
249 record->setObject("data", TimelineRecordFactory::createRasterizeData(m_layer ToNodeMap.get(layerId)));
247 state.recordStack.addScopedRecord(record.release()); 250 state.recordStack.addScopedRecord(record.release());
248 } 251 }
249 252
250 void TimelineTraceEventProcessor::onRasterTaskEnd(const TraceEvent& event) 253 void TimelineTraceEventProcessor::onRasterTaskEnd(const TraceEvent& event)
251 { 254 {
252 TimelineThreadState& state = threadState(event.threadIdentifier()); 255 TimelineThreadState& state = threadState(event.threadIdentifier());
253 if (!state.inKnownLayerTask) 256 if (!state.inKnownLayerTask)
254 return; 257 return;
255 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::Rasterize)); 258 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::Rasterize));
256 state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreas ingTime(event.timestamp())); 259 state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreas ingTime(event.timestamp()));
257 leaveLayerTask(state); 260 leaveLayerTask(state);
258 } 261 }
259 262
260 void TimelineTraceEventProcessor::onImageDecodeTaskBegin(const TraceEvent& event ) 263 void TimelineTraceEventProcessor::onImageDecodeTaskBegin(const TraceEvent& event )
261 { 264 {
262 maybeEnterLayerTask(event, threadState(event.threadIdentifier())); 265 maybeEnterLayerTask(event, threadState(event.threadIdentifier()));
263 } 266 }
264 267
265 void TimelineTraceEventProcessor::onImageDecodeTaskEnd(const TraceEvent& event) 268 void TimelineTraceEventProcessor::onImageDecodeTaskEnd(const TraceEvent& event)
266 { 269 {
267 leaveLayerTask(threadState(event.threadIdentifier())); 270 leaveLayerTask(threadState(event.threadIdentifier()));
268 } 271 }
269 272
270 bool TimelineTraceEventProcessor::maybeEnterLayerTask(const TraceEvent& event, T imelineThreadState& threadState) 273 bool TimelineTraceEventProcessor::maybeEnterLayerTask(const TraceEvent& event, T imelineThreadState& threadState)
271 { 274 {
272 unsigned long long layerId = event.asUInt(InstrumentationEventArguments::Lay erId); 275 unsigned long long layerId = event.asUInt(InstrumentationEventArguments::Lay erId);
273 if (!m_knownLayers.contains(layerId)) 276 if (!m_layerToNodeMap.contains(layerId))
274 return false; 277 return false;
275 ASSERT(!threadState.inKnownLayerTask); 278 ASSERT(!threadState.inKnownLayerTask);
276 threadState.inKnownLayerTask = true; 279 threadState.inKnownLayerTask = true;
277 return true; 280 return true;
278 } 281 }
279 282
280 void TimelineTraceEventProcessor::leaveLayerTask(TimelineThreadState& threadStat e) 283 void TimelineTraceEventProcessor::leaveLayerTask(TimelineThreadState& threadStat e)
281 { 284 {
282 threadState.inKnownLayerTask = false; 285 threadState.inKnownLayerTask = false;
283 } 286 }
(...skipping 13 matching lines...) Expand all
297 return; 300 return;
298 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::DecodeImage) ); 301 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::DecodeImage) );
299 state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreas ingTime(event.timestamp())); 302 state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreas ingTime(event.timestamp()));
300 } 303 }
301 304
302 void TimelineTraceEventProcessor::onLayerDeleted(const TraceEvent& event) 305 void TimelineTraceEventProcessor::onLayerDeleted(const TraceEvent& event)
303 { 306 {
304 unsigned long long id = event.id(); 307 unsigned long long id = event.id();
305 ASSERT(id); 308 ASSERT(id);
306 processBackgroundEvents(); 309 processBackgroundEvents();
307 m_knownLayers.remove(id); 310 m_layerToNodeMap.remove(id);
308 } 311 }
309 312
310 void TimelineTraceEventProcessor::onPaint(const TraceEvent& event) 313 void TimelineTraceEventProcessor::onPaint(const TraceEvent& event)
311 { 314 {
312 if (!m_layerId) 315 if (!m_layerId)
313 return; 316 return;
314 317
315 unsigned long long pageId = event.asUInt(InstrumentationEventArguments::Page Id); 318 unsigned long long pageId = event.asUInt(InstrumentationEventArguments::Page Id);
316 if (pageId == m_pageId) 319 if (pageId != m_pageId)
317 m_knownLayers.add(m_layerId); 320 return;
321 long long nodeId = event.asInt(InstrumentationEventArguments::NodeId);
322 ASSERT(nodeId);
323 m_layerToNodeMap.set(m_layerId, nodeId);
318 } 324 }
319 325
320 PassRefPtr<InspectorObject> TimelineTraceEventProcessor::createRecord(const Trac eEvent& event, const String& recordType, PassRefPtr<InspectorObject> data) 326 PassRefPtr<InspectorObject> TimelineTraceEventProcessor::createRecord(const Trac eEvent& event, const String& recordType, PassRefPtr<InspectorObject> data)
321 { 327 {
322 double startTime = m_timeConverter.fromMonotonicallyIncreasingTime(event.tim estamp()); 328 double startTime = m_timeConverter.fromMonotonicallyIncreasingTime(event.tim estamp());
323 RefPtr<InspectorObject> record = TimelineRecordFactory::createBackgroundReco rd(startTime, String::number(event.threadIdentifier())); 329 RefPtr<InspectorObject> record = TimelineRecordFactory::createBackgroundReco rd(startTime, String::number(event.threadIdentifier()));
324 record->setString("type", recordType); 330 record->setString("type", recordType);
325 record->setObject("data", data ? data : InspectorObject::create()); 331 record->setObject("data", data ? data : InspectorObject::create());
326 return record.release(); 332 return record.release();
327 } 333 }
(...skipping 10 matching lines...) Expand all
338 for (size_t i = 0, size = events.size(); i < size; ++i) { 344 for (size_t i = 0, size = events.size(); i < size; ++i) {
339 const TraceEvent& event = events[i]; 345 const TraceEvent& event = events[i];
340 HandlersMap::iterator it = m_handlersByType.find(std::make_pair(event.na me(), event.phase())); 346 HandlersMap::iterator it = m_handlersByType.find(std::make_pair(event.na me(), event.phase()));
341 ASSERT(it != m_handlersByType.end() && it->value); 347 ASSERT(it != m_handlersByType.end() && it->value);
342 (this->*(it->value))(event); 348 (this->*(it->value))(event);
343 } 349 }
344 } 350 }
345 351
346 } // namespace WebCore 352 } // namespace WebCore
347 353
OLDNEW
« no previous file with comments | « Source/core/inspector/TimelineTraceEventProcessor.h ('k') | Source/devtools/front_end/TimelinePresentationModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698