OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @implements {WebInspector.FlameChartDataProvider} | 33 * @implements {WebInspector.FlameChartDataProvider} |
34 * @param {!WebInspector.TracingTimelineModel} model | 34 * @param {!WebInspector.TimelineModel} model |
35 * @param {!WebInspector.TimelineFrameModelBase} frameModel | 35 * @param {!WebInspector.TimelineFrameModelBase} frameModel |
36 */ | 36 */ |
37 WebInspector.TimelineFlameChartDataProvider = function(model, frameModel) | 37 WebInspector.TimelineFlameChartDataProvider = function(model, frameModel) |
38 { | 38 { |
39 WebInspector.FlameChartDataProvider.call(this); | 39 WebInspector.FlameChartDataProvider.call(this); |
40 this.reset(); | 40 this.reset(); |
41 this._model = model; | 41 this._model = model; |
42 this._frameModel = frameModel; | 42 this._frameModel = frameModel; |
43 this._font = "12px " + WebInspector.fontFamily(); | 43 this._font = "12px " + WebInspector.fontFamily(); |
44 this._linkifier = new WebInspector.Linkifier(); | 44 this._linkifier = new WebInspector.Linkifier(); |
45 this._filters = []; | 45 this._filters = []; |
46 this.addFilter(WebInspector.TimelineUIUtils.hiddenEventsFilter()); | 46 this.addFilter(WebInspector.TimelineUIUtils.hiddenEventsFilter()); |
47 this.addFilter(new WebInspector.TracingTimelineModel.ExclusiveEventNameFilte
r([WebInspector.TracingTimelineModel.RecordType.Program])); | 47 this.addFilter(new WebInspector.ExclusiveTraceEventNameFilter([WebInspector.
TimelineModel.RecordType.Program])); |
48 } | 48 } |
49 | 49 |
50 WebInspector.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.01
; | 50 WebInspector.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.01
; |
51 WebInspector.TimelineFlameChartDataProvider.JSFrameCoalesceThresholdMs = 1.1; | 51 WebInspector.TimelineFlameChartDataProvider.JSFrameCoalesceThresholdMs = 1.1; |
52 | 52 |
53 /** | 53 /** |
54 * @return {!WebInspector.FlameChart.ColorGenerator} | 54 * @return {!WebInspector.FlameChart.ColorGenerator} |
55 */ | 55 */ |
56 WebInspector.TimelineFlameChartDataProvider.consoleEventsColorGenerator = functi
on() | 56 WebInspector.TimelineFlameChartDataProvider.consoleEventsColorGenerator = functi
on() |
57 { | 57 { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 entryTitle: function(entryIndex) | 105 entryTitle: function(entryIndex) |
106 { | 106 { |
107 var event = this._entryEvents[entryIndex]; | 107 var event = this._entryEvents[entryIndex]; |
108 if (event) { | 108 if (event) { |
109 if (event.phase === WebInspector.TracingModel.Phase.AsyncStepInto ||
event.phase === WebInspector.TracingModel.Phase.AsyncStepPast) | 109 if (event.phase === WebInspector.TracingModel.Phase.AsyncStepInto ||
event.phase === WebInspector.TracingModel.Phase.AsyncStepPast) |
110 return event.name + ":" + event.args["step"]; | 110 return event.name + ":" + event.args["step"]; |
111 | 111 |
112 var name = WebInspector.TimelineUIUtils.eventStyle(event).title; | 112 var name = WebInspector.TimelineUIUtils.eventStyle(event).title; |
113 // TODO(yurys): support event dividers | 113 // TODO(yurys): support event dividers |
114 var details = WebInspector.TimelineUIUtils.buildDetailsNodeForTraceE
vent(event, this._linkifier); | 114 var details = WebInspector.TimelineUIUtils.buildDetailsNodeForTraceE
vent(event, this._linkifier); |
115 if (event.name === WebInspector.TracingTimelineModel.RecordType.JSFr
ame && details) | 115 if (event.name === WebInspector.TimelineModel.RecordType.JSFrame &&
details) |
116 return details.textContent; | 116 return details.textContent; |
117 return details ? WebInspector.UIString("%s (%s)", name, details.text
Content) : name; | 117 return details ? WebInspector.UIString("%s (%s)", name, details.text
Content) : name; |
118 } | 118 } |
119 var title = this._entryIndexToTitle[entryIndex]; | 119 var title = this._entryIndexToTitle[entryIndex]; |
120 if (!title) { | 120 if (!title) { |
121 title = WebInspector.UIString("Unexpected entryIndex %d", entryIndex
); | 121 title = WebInspector.UIString("Unexpected entryIndex %d", entryIndex
); |
122 console.error(title); | 122 console.error(title); |
123 } | 123 } |
124 return title; | 124 return title; |
125 }, | 125 }, |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 * @param {!Array.<!WebInspector.TimelineFrame>} frames | 290 * @param {!Array.<!WebInspector.TimelineFrame>} frames |
291 */ | 291 */ |
292 _appendFrameBars: function(frames) | 292 _appendFrameBars: function(frames) |
293 { | 293 { |
294 this._frameBarsLevel = this._currentLevel++; | 294 this._frameBarsLevel = this._currentLevel++; |
295 for (var i = 0; i < frames.length; ++i) | 295 for (var i = 0; i < frames.length; ++i) |
296 this._appendFrame(frames[i]); | 296 this._appendFrame(frames[i]); |
297 }, | 297 }, |
298 | 298 |
299 /** | 299 /** |
300 * @param {!WebInspector.TracingTimelineModel.Filter} filter | 300 * @param {!WebInspector.TraceEventFilter} filter |
301 */ | 301 */ |
302 addFilter: function(filter) | 302 addFilter: function(filter) |
303 { | 303 { |
304 this._filters.push(filter); | 304 this._filters.push(filter); |
305 }, | 305 }, |
306 | 306 |
307 /** | 307 /** |
308 * @param {!WebInspector.TracingModel.Event} event | 308 * @param {!WebInspector.TracingModel.Event} event |
309 * @return {boolean} | 309 * @return {boolean} |
310 */ | 310 */ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 /** | 358 /** |
359 * @param {number} entryIndex | 359 * @param {number} entryIndex |
360 * @return {string} | 360 * @return {string} |
361 */ | 361 */ |
362 entryColor: function(entryIndex) | 362 entryColor: function(entryIndex) |
363 { | 363 { |
364 var event = this._entryEvents[entryIndex]; | 364 var event = this._entryEvents[entryIndex]; |
365 if (!event) | 365 if (!event) |
366 return this._entryIndexToFrame[entryIndex] ? "white" : "#555"; | 366 return this._entryIndexToFrame[entryIndex] ? "white" : "#555"; |
367 if (event.name === WebInspector.TracingTimelineModel.RecordType.JSFrame) | 367 if (event.name === WebInspector.TimelineModel.RecordType.JSFrame) |
368 return this._timelineData.entryLevels[entryIndex] % 2 ? "#efb320" :
"#fcc02d"; | 368 return this._timelineData.entryLevels[entryIndex] % 2 ? "#efb320" :
"#fcc02d"; |
369 var category = WebInspector.TimelineUIUtils.eventStyle(event).category; | 369 var category = WebInspector.TimelineUIUtils.eventStyle(event).category; |
370 if (WebInspector.TracingModel.isAsyncPhase(event.phase)) { | 370 if (WebInspector.TracingModel.isAsyncPhase(event.phase)) { |
371 if (event.category === WebInspector.TracingModel.ConsoleEventCategor
y) | 371 if (event.category === WebInspector.TracingModel.ConsoleEventCategor
y) |
372 return WebInspector.TimelineFlameChartDataProvider.consoleEvents
ColorGenerator().colorForID(event.name); | 372 return WebInspector.TimelineFlameChartDataProvider.consoleEvents
ColorGenerator().colorForID(event.name); |
373 var color = this._asyncColorByCategory[category.name]; | 373 var color = this._asyncColorByCategory[category.name]; |
374 if (color) | 374 if (color) |
375 return color; | 375 return color; |
376 var parsedColor = WebInspector.Color.parse(category.fillColorStop1); | 376 var parsedColor = WebInspector.Color.parse(category.fillColorStop1); |
377 color = parsedColor.setAlpha(0.7).toString(WebInspector.Color.Format
.RGBA) || ""; | 377 color = parsedColor.setAlpha(0.7).toString(WebInspector.Color.Format
.RGBA) || ""; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 return -1; | 642 return -1; |
643 } | 643 } |
644 } | 644 } |
645 | 645 |
646 /** | 646 /** |
647 * @constructor | 647 * @constructor |
648 * @extends {WebInspector.VBox} | 648 * @extends {WebInspector.VBox} |
649 * @implements {WebInspector.TimelineModeView} | 649 * @implements {WebInspector.TimelineModeView} |
650 * @implements {WebInspector.FlameChartDelegate} | 650 * @implements {WebInspector.FlameChartDelegate} |
651 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 651 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
652 * @param {!WebInspector.TracingTimelineModel} tracingModel | 652 * @param {!WebInspector.TimelineModel} tracingModel |
653 * @param {!WebInspector.TimelineFrameModelBase} frameModel | 653 * @param {!WebInspector.TimelineFrameModelBase} frameModel |
654 */ | 654 */ |
655 WebInspector.TimelineFlameChart = function(delegate, tracingModel, frameModel) | 655 WebInspector.TimelineFlameChart = function(delegate, tracingModel, frameModel) |
656 { | 656 { |
657 WebInspector.VBox.call(this); | 657 WebInspector.VBox.call(this); |
658 this.element.classList.add("timeline-flamechart"); | 658 this.element.classList.add("timeline-flamechart"); |
659 this._delegate = delegate; | 659 this._delegate = delegate; |
660 this._model = tracingModel; | 660 this._model = tracingModel; |
661 this._dataProvider = new WebInspector.TimelineFlameChartDataProvider(tracing
Model, frameModel) | 661 this._dataProvider = new WebInspector.TimelineFlameChartDataProvider(tracing
Model, frameModel) |
662 this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true)
; | 662 this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true)
; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 /** | 788 /** |
789 * @constructor | 789 * @constructor |
790 * @param {!WebInspector.TimelineSelection} selection | 790 * @param {!WebInspector.TimelineSelection} selection |
791 * @param {number} entryIndex | 791 * @param {number} entryIndex |
792 */ | 792 */ |
793 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex) | 793 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex) |
794 { | 794 { |
795 this.timelineSelection = selection; | 795 this.timelineSelection = selection; |
796 this.entryIndex = entryIndex; | 796 this.entryIndex = entryIndex; |
797 } | 797 } |
OLD | NEW |