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

Side by Side Diff: Source/devtools/front_end/timeline/TracingTimelineModel.js

Issue 463033002: Do not coalesce events from different threads having same name (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineFlameChart.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {!WebInspector.TracingModel} tracingModel 7 * @param {!WebInspector.TracingModel} tracingModel
8 * @param {!WebInspector.TimelineModel.Filter} recordFilter 8 * @param {!WebInspector.TimelineModel.Filter} recordFilter
9 * @extends {WebInspector.TimelineModel} 9 * @extends {WebInspector.TimelineModel}
10 */ 10 */
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 DecodeImage: "Decode Image", 91 DecodeImage: "Decode Image",
92 ResizeImage: "Resize Image", 92 ResizeImage: "Resize Image",
93 DrawLazyPixelRef: "Draw LazyPixelRef", 93 DrawLazyPixelRef: "Draw LazyPixelRef",
94 DecodeLazyPixelRef: "Decode LazyPixelRef", 94 DecodeLazyPixelRef: "Decode LazyPixelRef",
95 95
96 LazyPixelRef: "LazyPixelRef", 96 LazyPixelRef: "LazyPixelRef",
97 LayerTreeHostImplSnapshot: "cc::LayerTreeHostImpl", 97 LayerTreeHostImplSnapshot: "cc::LayerTreeHostImpl",
98 PictureSnapshot: "cc::Picture" 98 PictureSnapshot: "cc::Picture"
99 }; 99 };
100 100
101 /**
102 * @constructor
103 * @param {string} name
104 */
105 WebInspector.TracingTimelineModel.VirtualThread = function(name)
106 {
107 this.name = name;
108 /** @type {!Array.<!WebInspector.TracingModel.Event>} */
109 this.events = [];
110 }
111
101 WebInspector.TracingTimelineModel.prototype = { 112 WebInspector.TracingTimelineModel.prototype = {
102 /** 113 /**
103 * @param {boolean} captureStacks 114 * @param {boolean} captureStacks
104 * @param {boolean} captureMemory 115 * @param {boolean} captureMemory
105 * @param {boolean} capturePictures 116 * @param {boolean} capturePictures
106 */ 117 */
107 startRecording: function(captureStacks, captureMemory, capturePictures) 118 startRecording: function(captureStacks, captureMemory, capturePictures)
108 { 119 {
109 function disabledByDefault(category) 120 function disabledByDefault(category)
110 { 121 {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 inspectedTargetEvents: function() 263 inspectedTargetEvents: function()
253 { 264 {
254 return this._inspectedTargetEvents; 265 return this._inspectedTargetEvents;
255 }, 266 },
256 267
257 /** 268 /**
258 * @return {!Array.<!WebInspector.TracingModel.Event>} 269 * @return {!Array.<!WebInspector.TracingModel.Event>}
259 */ 270 */
260 mainThreadEvents: function() 271 mainThreadEvents: function()
261 { 272 {
262 return this._virtualThreads[WebInspector.TimelineModel.MainThreadName] | | []; 273 return this._mainThreadEvents;
263 }, 274 },
264 275
265 /** 276 /**
266 * @param {!Array.<!WebInspector.TracingModel.Event>} events 277 * @param {!Array.<!WebInspector.TracingModel.Event>} events
267 */ 278 */
268 _setMainThreadEvents: function(events) 279 _setMainThreadEvents: function(events)
269 { 280 {
270 this._virtualThreads[WebInspector.TimelineModel.MainThreadName] = events ; 281 this._mainThreadEvents = events;
271 }, 282 },
272 283
273 /** 284 /**
274 * @return {!Object.<string, !Array.<!WebInspector.TracingModel.Event>>} 285 * @return {!Array.<!WebInspector.TracingTimelineModel.VirtualThread>}
275 */ 286 */
276 virtualThreads: function() 287 virtualThreads: function()
277 { 288 {
278 return this._virtualThreads; 289 return this._virtualThreads;
279 }, 290 },
280 291
281 /** 292 /**
282 * @param {!WebInspector.ChunkedFileReader} fileReader 293 * @param {!WebInspector.ChunkedFileReader} fileReader
283 * @param {!WebInspector.Progress} progress 294 * @param {!WebInspector.Progress} progress
284 * @return {!WebInspector.OutputStream} 295 * @return {!WebInspector.OutputStream}
285 */ 296 */
286 createLoader: function(fileReader, progress) 297 createLoader: function(fileReader, progress)
287 { 298 {
288 return new WebInspector.TracingModelLoader(this, fileReader, progress); 299 return new WebInspector.TracingModelLoader(this, fileReader, progress);
289 }, 300 },
290 301
291 /** 302 /**
292 * @param {!WebInspector.OutputStream} stream 303 * @param {!WebInspector.OutputStream} stream
293 */ 304 */
294 writeToStream: function(stream) 305 writeToStream: function(stream)
295 { 306 {
296 var saver = new WebInspector.TracingTimelineSaver(stream); 307 var saver = new WebInspector.TracingTimelineSaver(stream);
297 var events = this._tracingModel.rawEvents(); 308 var events = this._tracingModel.rawEvents();
298 saver.save(events); 309 saver.save(events);
299 }, 310 },
300 311
301 reset: function() 312 reset: function()
302 { 313 {
303 this._virtualThreads = {}; 314 this._virtualThreads = [];
315 this._mainThreadEvents = [];
304 this._inspectedTargetEvents = []; 316 this._inspectedTargetEvents = [];
305 WebInspector.TimelineModel.prototype.reset.call(this); 317 WebInspector.TimelineModel.prototype.reset.call(this);
306 }, 318 },
307 319
308 _buildTimelineRecords: function() 320 _buildTimelineRecords: function()
309 { 321 {
310 var recordStack = []; 322 var recordStack = [];
311 var mainThreadEvents = this.mainThreadEvents(); 323 var mainThreadEvents = this.mainThreadEvents();
312 for (var i = 0, size = mainThreadEvents.length; i < size; ++i) { 324 for (var i = 0, size = mainThreadEvents.length; i < size; ++i) {
313 var event = mainThreadEvents[i]; 325 var event = mainThreadEvents[i];
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 * @param {?number} endTime 380 * @param {?number} endTime
369 * @param {!WebInspector.TracingModel.Thread} mainThread 381 * @param {!WebInspector.TracingModel.Thread} mainThread
370 * @param {!WebInspector.TracingModel.Thread} thread 382 * @param {!WebInspector.TracingModel.Thread} thread
371 */ 383 */
372 _processThreadEvents: function(startTime, endTime, mainThread, thread) 384 _processThreadEvents: function(startTime, endTime, mainThread, thread)
373 { 385 {
374 var events = thread.events(); 386 var events = thread.events();
375 var length = events.length; 387 var length = events.length;
376 var i = events.lowerBound(startTime, function (time, event) { return tim e - event.startTime }); 388 var i = events.lowerBound(startTime, function (time, event) { return tim e - event.startTime });
377 389
390 var threadEvents;
391 if (thread === mainThread) {
392 threadEvents = this._mainThreadEvents;
393 } else {
394 var virtualThread = new WebInspector.TracingTimelineModel.VirtualThr ead(thread.name());
395 threadEvents = virtualThread.events;
396 this._virtualThreads.push(virtualThread);
397 }
398
378 this._eventStack = []; 399 this._eventStack = [];
379 for (; i < length; i++) { 400 for (; i < length; i++) {
380 var event = events[i]; 401 var event = events[i];
381 if (endTime && event.startTime >= endTime) 402 if (endTime && event.startTime >= endTime)
382 break; 403 break;
383 this._processEvent(event); 404 this._processEvent(event);
384 var threadName = thread === mainThread ? WebInspector.TimelineModel. MainThreadName : thread.name();
385 var threadEvents = this._virtualThreads[threadName];
386 if (!threadEvents) {
387 threadEvents = [];
388 this._virtualThreads[threadName] = threadEvents;
389 }
390 threadEvents.push(event); 405 threadEvents.push(event);
391 this._inspectedTargetEvents.push(event); 406 this._inspectedTargetEvents.push(event);
392 } 407 }
393 }, 408 },
394 409
395 /** 410 /**
396 * @param {!WebInspector.TracingModel.Event} event 411 * @param {!WebInspector.TracingModel.Event} event
397 */ 412 */
398 _processEvent: function(event) 413 _processEvent: function(event)
399 { 414 {
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 }, 994 },
980 995
981 _didWriteNextChunk: function(stream) 996 _didWriteNextChunk: function(stream)
982 { 997 {
983 if (this._recordIndex === this._payloads.length) 998 if (this._recordIndex === this._payloads.length)
984 stream.close(); 999 stream.close();
985 else 1000 else
986 this._writeNextChunk(stream); 1001 this._writeNextChunk(stream);
987 } 1002 }
988 } 1003 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineFlameChart.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698