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

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

Issue 318093002: Convert timestamp to milliseconds when creating TracingModel.Event (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * @constructor 8 * @constructor
9 * @implements {WebInspector.TimelineModeView} 9 * @implements {WebInspector.TimelineModeView}
10 * @implements {WebInspector.FlameChartDelegate} 10 * @implements {WebInspector.FlameChartDelegate}
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 { 107 {
108 var index = /** @type {number} */ (event.data); 108 var index = /** @type {number} */ (event.data);
109 var record = this._dataProvider._recordAt(index); 109 var record = this._dataProvider._recordAt(index);
110 if (!record || this._dataProvider._isHeaderRecord(record)) { 110 if (!record || this._dataProvider._isHeaderRecord(record)) {
111 this._delegate.showInDetails("", document.createTextNode("")); 111 this._delegate.showInDetails("", document.createTextNode(""));
112 return; 112 return;
113 } 113 }
114 var contentHelper = new WebInspector.TimelineDetailsContentHelper(null, null, false); 114 var contentHelper = new WebInspector.TimelineDetailsContentHelper(null, null, false);
115 contentHelper.appendTextRow(WebInspector.UIString("Name"), record.name); 115 contentHelper.appendTextRow(WebInspector.UIString("Name"), record.name);
116 contentHelper.appendTextRow(WebInspector.UIString("Category"), record.ca tegory); 116 contentHelper.appendTextRow(WebInspector.UIString("Category"), record.ca tegory);
117 contentHelper.appendTextRow(WebInspector.UIString("Start"), Number.milli sToString(this._dataProvider._toTimelineTime(record.startTime - this._tracingMod el.minimumRecordTime()), true)); 117 contentHelper.appendTextRow(WebInspector.UIString("Start"), Number.milli sToString(record.startTime - this._tracingModel.minimumRecordTime(), true));
118 contentHelper.appendTextRow(WebInspector.UIString("Duration"), Number.mi llisToString(this._dataProvider._toTimelineTime(record.duration), true)); 118 contentHelper.appendTextRow(WebInspector.UIString("Duration"), Number.mi llisToString(record.duration, true));
119 if (!Object.isEmpty(record.args)) 119 if (!Object.isEmpty(record.args))
120 contentHelper.appendElementRow(WebInspector.UIString("Arguments"), t his._formatArguments(record.args)); 120 contentHelper.appendElementRow(WebInspector.UIString("Arguments"), t his._formatArguments(record.args));
121 /** 121 /**
122 * @this {WebInspector.TimelineTracingView} 122 * @this {WebInspector.TimelineTracingView}
123 */ 123 */
124 function reveal() 124 function reveal()
125 { 125 {
126 WebInspector.Revealer.reveal(new WebInspector.DeferredTracingLayerTr ee(this._tracingModel.target(), record.args["snapshot"]["active_tree"]["root_lay er"])); 126 WebInspector.Revealer.reveal(new WebInspector.DeferredTracingLayerTr ee(this._tracingModel.target(), record.args["snapshot"]["active_tree"]["root_lay er"]));
127 } 127 }
128 if (record.name === "cc::LayerTreeHostImpl") { 128 if (record.name === "cc::LayerTreeHostImpl") {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 * @type {?WebInspector.FlameChart.TimelineData} 308 * @type {?WebInspector.FlameChart.TimelineData}
309 */ 309 */
310 this._timelineData = { 310 this._timelineData = {
311 entryLevels: [], 311 entryLevels: [],
312 entryTotalTimes: [], 312 entryTotalTimes: [],
313 entryStartTimes: [] 313 entryStartTimes: []
314 }; 314 };
315 315
316 this._currentLevel = 0; 316 this._currentLevel = 0;
317 this._headerTitles = {}; 317 this._headerTitles = {};
318 this._minimumBoundary = this._timelineModelForMinimumBoundary.minimumRec ordTime() * 1000; 318 this._minimumBoundary = this._timelineModelForMinimumBoundary.minimumRec ordTime();
319 this._timeSpan = Math.max((this._model.maximumRecordTime() || 0) - this. _minimumBoundary, 1000000); 319 this._timeSpan = Math.max((this._model.maximumRecordTime() || 0) - this. _minimumBoundary, 1000);
320 var processes = this._model.sortedProcesses(); 320 var processes = this._model.sortedProcesses();
321 for (var processIndex = 0; processIndex < processes.length; ++processInd ex) { 321 for (var processIndex = 0; processIndex < processes.length; ++processInd ex) {
322 var process = processes[processIndex]; 322 var process = processes[processIndex];
323 this._appendHeaderRecord(process.name(), this._processHeaderRecord); 323 this._appendHeaderRecord(process.name(), this._processHeaderRecord);
324 var objectNames = process.sortedObjectNames(); 324 var objectNames = process.sortedObjectNames();
325 for (var objectNameIndex = 0; objectNameIndex < objectNames.length; ++objectNameIndex) { 325 for (var objectNameIndex = 0; objectNameIndex < objectNames.length; ++objectNameIndex) {
326 this._appendHeaderRecord(WebInspector.UIString("Object %s", obje ctNames[objectNameIndex]), this._threadHeaderRecord); 326 this._appendHeaderRecord(WebInspector.UIString("Object %s", obje ctNames[objectNameIndex]), this._threadHeaderRecord);
327 var objects = process.objectsByName(objectNames[objectNameIndex] ); 327 var objects = process.objectsByName(objectNames[objectNameIndex] );
328 for (var objectIndex = 0; objectIndex < objects.length; ++object Index) 328 for (var objectIndex = 0; objectIndex < objects.length; ++object Index)
329 this._appendRecord(objects[objectIndex]); 329 this._appendRecord(objects[objectIndex]);
(...skipping 13 matching lines...) Expand all
343 ++this._currentLevel; 343 ++this._currentLevel;
344 } 344 }
345 return this._timelineData; 345 return this._timelineData;
346 }, 346 },
347 347
348 /** 348 /**
349 * @return {number} 349 * @return {number}
350 */ 350 */
351 minimumBoundary: function() 351 minimumBoundary: function()
352 { 352 {
353 return this._toTimelineTime(this._minimumBoundary); 353 return this._minimumBoundary;
354 }, 354 },
355 355
356 /** 356 /**
357 * @return {number} 357 * @return {number}
358 */ 358 */
359 totalTime: function() 359 totalTime: function()
360 { 360 {
361 return this._toTimelineTime(this._timeSpan); 361 return this._timeSpan;
362 }, 362 },
363 363
364 /** 364 /**
365 * @return {number} 365 * @return {number}
366 */ 366 */
367 maxStackDepth: function() 367 maxStackDepth: function()
368 { 368 {
369 return this._currentLevel; 369 return this._currentLevel;
370 }, 370 },
371 371
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 /** 432 /**
433 * @param {number} entryIndex 433 * @param {number} entryIndex
434 * @return {?{startTime: number, endTime: number}} 434 * @return {?{startTime: number, endTime: number}}
435 */ 435 */
436 highlightTimeRange: function(entryIndex) 436 highlightTimeRange: function(entryIndex)
437 { 437 {
438 var record = this._records[entryIndex]; 438 var record = this._records[entryIndex];
439 if (!record || this._isHeaderRecord(record)) 439 if (!record || this._isHeaderRecord(record))
440 return null; 440 return null;
441 return { 441 return {
442 startTime: this._toTimelineTime(record.startTime), 442 startTime: record.startTime,
443 endTime: this._toTimelineTime(record.endTime) 443 endTime: record.endTime
444 } 444 }
445 }, 445 },
446 446
447 /** 447 /**
448 * @return {number} 448 * @return {number}
449 */ 449 */
450 paddingLeft: function() 450 paddingLeft: function()
451 { 451 {
452 return 0; 452 return 0;
453 }, 453 },
(...skipping 10 matching lines...) Expand all
464 /** 464 /**
465 * @param {string} title 465 * @param {string} title
466 * @param {!WebInspector.TracingModel.Event} record 466 * @param {!WebInspector.TracingModel.Event} record
467 */ 467 */
468 _appendHeaderRecord: function(title, record) 468 _appendHeaderRecord: function(title, record)
469 { 469 {
470 var index = this._records.length; 470 var index = this._records.length;
471 this._records.push(record); 471 this._records.push(record);
472 this._timelineData.entryLevels[index] = this._currentLevel++; 472 this._timelineData.entryLevels[index] = this._currentLevel++;
473 this._timelineData.entryTotalTimes[index] = this.totalTime(); 473 this._timelineData.entryTotalTimes[index] = this.totalTime();
474 this._timelineData.entryStartTimes[index] = this._toTimelineTime(this._m inimumBoundary); 474 this._timelineData.entryStartTimes[index] = this._minimumBoundary;
475 this._headerTitles[index] = title; 475 this._headerTitles[index] = title;
476 }, 476 },
477 477
478 /** 478 /**
479 * @param {!WebInspector.TracingModel.Event} record 479 * @param {!WebInspector.TracingModel.Event} record
480 */ 480 */
481 _appendRecord: function(record) 481 _appendRecord: function(record)
482 { 482 {
483 var index = this._records.length; 483 var index = this._records.length;
484 this._records.push(record); 484 this._records.push(record);
485 this._timelineData.entryLevels[index] = this._currentLevel + record.leve l; 485 this._timelineData.entryLevels[index] = this._currentLevel + record.leve l;
486 this._timelineData.entryTotalTimes[index] = this._toTimelineTime(record. phase === WebInspector.TracingModel.Phase.SnapshotObject ? NaN : record.duration || 0); 486 this._timelineData.entryTotalTimes[index] = record.phase === WebInspecto r.TracingModel.Phase.SnapshotObject ? NaN : record.duration || 0;
487 this._timelineData.entryStartTimes[index] = this._toTimelineTime(record. startTime); 487 this._timelineData.entryStartTimes[index] = record.startTime;
488 }, 488 },
489 489
490 /** 490 /**
491 * @param {number} time
492 * @return {number}
493 */
494 _toTimelineTime: function(time)
495 {
496 return time / 1000;
497 },
498
499 /**
500 * @param {!WebInspector.TracingModel.Event} record 491 * @param {!WebInspector.TracingModel.Event} record
501 */ 492 */
502 _isHeaderRecord: function(record) 493 _isHeaderRecord: function(record)
503 { 494 {
504 return record === this._threadHeaderRecord || record === this._processHe aderRecord; 495 return record === this._threadHeaderRecord || record === this._processHe aderRecord;
505 }, 496 },
506 497
507 /** 498 /**
508 * @param {number} index 499 * @param {number} index
509 * @return {!WebInspector.TracingModel.Event|undefined} 500 * @return {!WebInspector.TracingModel.Event|undefined}
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 /** 573 /**
583 * @param {string} string 574 * @param {string} string
584 * @return {string} 575 * @return {string}
585 */ 576 */
586 colorForString: function(string) 577 colorForString: function(string)
587 { 578 {
588 var hash = WebInspector.TraceViewPalette._stringHash(string); 579 var hash = WebInspector.TraceViewPalette._stringHash(string);
589 return this._palette[hash % this._palette.length]; 580 return this._palette[hash % this._palette.length];
590 } 581 }
591 }; 582 };
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineModel.js ('k') | Source/devtools/front_end/timeline/TracingModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698