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

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

Issue 213673005: Timeline: show selected event details in Tracing mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | « no previous file | Source/devtools/front_end/TracingModel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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}
11 * @extends {WebInspector.VBox} 11 * @extends {WebInspector.VBox}
12 * @param {!WebInspector.TimelineModeViewDelegate} delegate 12 * @param {!WebInspector.TimelineModeViewDelegate} delegate
13 */ 13 */
14 WebInspector.TimelineTracingView = function(delegate) 14 WebInspector.TimelineTracingView = function(delegate)
15 { 15 {
16 WebInspector.VBox.call(this); 16 WebInspector.VBox.call(this);
17 this._delegate = delegate; 17 this._delegate = delegate;
18 this._tracingModel = new WebInspector.TracingModel(); 18 this._tracingModel = new WebInspector.TracingModel();
19 this.element.classList.add("timeline-flamechart"); 19 this.element.classList.add("timeline-flamechart");
20 this.registerRequiredCSS("flameChart.css"); 20 this.registerRequiredCSS("flameChart.css");
21 this._delegate = delegate;
22 this._dataProvider = new WebInspector.TraceViewFlameChartDataProvider(this._ tracingModel); 21 this._dataProvider = new WebInspector.TraceViewFlameChartDataProvider(this._ tracingModel);
23 this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true, true); 22 this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true, true);
24 this._mainView.show(this.element); 23 this._mainView.show(this.element);
25 this._mainView.addEventListener(WebInspector.FlameChart.Events.EntrySelected , this._onEntrySelected, this); 24 this._mainView.addEventListener(WebInspector.FlameChart.Events.EntrySelected , this._onEntrySelected, this);
26 } 25 }
27 26
28 WebInspector.TimelineTracingView.prototype = { 27 WebInspector.TimelineTracingView.prototype = {
29 timelineStarted: function() 28 timelineStarted: function()
30 { 29 {
31 if (this._recordingTrace) 30 if (this._recordingTrace)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 /** 121 /**
123 * @param {?WebInspector.TimelineModel.Record} record 122 * @param {?WebInspector.TimelineModel.Record} record
124 */ 123 */
125 setSelectedRecord: function(record) {}, 124 setSelectedRecord: function(record) {},
126 125
127 /** 126 /**
128 * @param {!WebInspector.Event} event 127 * @param {!WebInspector.Event} event
129 */ 128 */
130 _onEntrySelected: function(event) 129 _onEntrySelected: function(event)
131 { 130 {
131 var index = /** @type {number} */ (event.data);
132 var record = this._dataProvider._recordAt(index);
133 if (!record || this._dataProvider._isHeaderRecord(record)) {
134 this._delegate.showInDetails("", document.createTextNode(""));
135 return;
136 }
137 var contentHelper = new WebInspector.TimelineDetailsContentHelper(new We bInspector.Linkifier(), false);
138 contentHelper.appendTextRow(WebInspector.UIString("Name"), record.name);
139 contentHelper.appendTextRow(WebInspector.UIString("Category"), record.ca tegory);
140 contentHelper.appendTextRow(WebInspector.UIString("Start"), Number.milli sToString(this._dataProvider._toTimelineTime(record.startTime - this._tracingMod el.minimumRecordTime()), true));
141 contentHelper.appendTextRow(WebInspector.UIString("Duration"), Number.mi llisToString(this._dataProvider._toTimelineTime(record.duration), true));
142 if (!Object.isEmpty(record.args)) {
143 var table = document.createElement("table");
pfeldman 2014/04/01 14:17:01 Is there a screenshot?
144 for (var name in record.args) {
145 var row = table.createChild("tr");
146 row.createChild("td", "timeline-details-row-title").textContent = name + ":";
147 row.createChild("td", "timeline-details-row-data").textContent = record.args[name];
148 }
149 contentHelper.appendElementRow(WebInspector.UIString("Arguments"), t able);
150 }
151 this._delegate.showInDetails(WebInspector.UIString("Selected Event"), co ntentHelper.element);
132 }, 152 },
133 153
134 __proto__: WebInspector.VBox.prototype 154 __proto__: WebInspector.VBox.prototype
135 }; 155 };
136 156
137 /** 157 /**
138 * @constructor 158 * @constructor
139 * @implements {WebInspector.FlameChartDataProvider} 159 * @implements {WebInspector.FlameChartDataProvider}
140 * @param {!WebInspector.TracingModel} model 160 * @param {!WebInspector.TracingModel} model
141 */ 161 */
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return this._font; 215 return this._font;
196 }, 216 },
197 217
198 /** 218 /**
199 * @param {number} entryIndex 219 * @param {number} entryIndex
200 * @return {?string} 220 * @return {?string}
201 */ 221 */
202 entryTitle: function(entryIndex) 222 entryTitle: function(entryIndex)
203 { 223 {
204 var record = this._records[entryIndex]; 224 var record = this._records[entryIndex];
205 if (record === this._threadHeaderRecord || record === this._processHeade rRecord) 225 if (this._isHeaderRecord(record))
206 return this._headerTitles[entryIndex] 226 return this._headerTitles[entryIndex]
207 return record.name; 227 return record.name;
208 }, 228 },
209 229
210 /** 230 /**
211 * @param {number} startTime 231 * @param {number} startTime
212 * @param {number} endTime 232 * @param {number} endTime
213 * @return {?Array.<number>} 233 * @return {?Array.<number>}
214 */ 234 */
215 dividerOffsets: function(startTime, endTime) 235 dividerOffsets: function(startTime, endTime)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 { 364 {
345 return false; 365 return false;
346 }, 366 },
347 367
348 /** 368 /**
349 * @param {number} entryIndex 369 * @param {number} entryIndex
350 * @return {?{startTimeOffset: number, endTimeOffset: number}} 370 * @return {?{startTimeOffset: number, endTimeOffset: number}}
351 */ 371 */
352 highlightTimeRange: function(entryIndex) 372 highlightTimeRange: function(entryIndex)
353 { 373 {
354 return null; 374 var record = this._records[entryIndex];
375 if (!record || this._isHeaderRecord(record))
376 return null;
377 return {
378 startTimeOffset: this._toTimelineTime(record.startTime - this._zeroT ime),
379 endTimeOffset: this._toTimelineTime(record.endTime - this._zeroTime )
380 }
355 }, 381 },
356 382
357 /** 383 /**
358 * @return {number} 384 * @return {number}
359 */ 385 */
360 paddingLeft: function() 386 paddingLeft: function()
361 { 387 {
362 return 0; 388 return 0;
363 }, 389 },
364 390
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 this._timelineData.entryOffsets[index] = this._toTimelineTime(record.sta rtTime - this._zeroTime); 423 this._timelineData.entryOffsets[index] = this._toTimelineTime(record.sta rtTime - this._zeroTime);
398 }, 424 },
399 425
400 /** 426 /**
401 * @param {number} time 427 * @param {number} time
402 * @return {number} 428 * @return {number}
403 */ 429 */
404 _toTimelineTime: function(time) 430 _toTimelineTime: function(time)
405 { 431 {
406 return time / 1000; 432 return time / 1000;
433 },
434
435 /**
436 * @param {!WebInspector.TracingModel.Event} record
437 */
438 _isHeaderRecord: function(record)
439 {
440 return record === this._threadHeaderRecord || record === this._processHe aderRecord;
441 },
442
443 /**
444 * @param {number} index
445 * @return {!WebInspector.TracingModel.Event|undefined}
446 */
447 _recordAt: function(index)
448 {
449 return this._records[index];
407 } 450 }
408 } 451 }
409 452
410 // The below logic is shamelessly stolen from https://code.google.com/p/trace-vi ewer/source/browse/trunk/trace_viewer/tracing/color_scheme.js 453 // The below logic is shamelessly stolen from https://code.google.com/p/trace-vi ewer/source/browse/trunk/trace_viewer/tracing/color_scheme.js
411 454
412 /** 455 /**
413 * @constructor 456 * @constructor
414 */ 457 */
415 WebInspector.TraceViewPalette = function() 458 WebInspector.TraceViewPalette = function()
416 { 459 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 /** 518 /**
476 * @param {string} string 519 * @param {string} string
477 * @return {string} 520 * @return {string}
478 */ 521 */
479 colorForString: function(string) 522 colorForString: function(string)
480 { 523 {
481 var hash = WebInspector.TraceViewPalette._stringHash(string); 524 var hash = WebInspector.TraceViewPalette._stringHash(string);
482 return this._palette[hash % this._palette.length]; 525 return this._palette[hash % this._palette.length];
483 } 526 }
484 }; 527 };
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/TracingModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698