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

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

Issue 713913002: DevTools: merge TracingTimelineUIUtils into TimelineUIUtils (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Deleted instance refs Created 6 years, 1 month 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) 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 25 matching lines...) Expand all
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.TracingTimelineUIUtils.hiddenEventsFilter()); 46 this.addFilter(WebInspector.TimelineUIUtils.hiddenEventsFilter());
47 this.addFilter(new WebInspector.TracingTimelineModel.ExclusiveEventNameFilte r([WebInspector.TracingTimelineModel.RecordType.Program])); 47 this.addFilter(new WebInspector.TracingTimelineModel.ExclusiveEventNameFilte r([WebInspector.TracingTimelineModel.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()
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 * @param {number} entryIndex 102 * @param {number} entryIndex
103 * @return {?string} 103 * @return {?string}
104 */ 104 */
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.TracingTimelineUIUtils.eventStyle(event).tit le; 112 var name = WebInspector.TimelineUIUtils.eventStyle(event).title;
113 // TODO(yurys): support event dividers 113 // TODO(yurys): support event dividers
114 var details = WebInspector.TracingTimelineUIUtils.buildDetailsNodeFo rTraceEvent(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.TracingTimelineModel.RecordType.JSFr ame && 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;
(...skipping 10 matching lines...) Expand all
135 }, 135 },
136 136
137 /** 137 /**
138 * @override 138 * @override
139 * @param {number} index 139 * @param {number} index
140 * @return {string} 140 * @return {string}
141 */ 141 */
142 markerColor: function(index) 142 markerColor: function(index)
143 { 143 {
144 var event = this._markerEvents[index]; 144 var event = this._markerEvents[index];
145 return WebInspector.TracingTimelineUIUtils.markerEventColor(event); 145 return WebInspector.TimelineUIUtils.markerEventColor(event);
146 }, 146 },
147 147
148 /** 148 /**
149 * @override 149 * @override
150 * @param {number} index 150 * @param {number} index
151 * @return {string} 151 * @return {string}
152 */ 152 */
153 markerTitle: function(index) 153 markerTitle: function(index)
154 { 154 {
155 var event = this._markerEvents[index]; 155 var event = this._markerEvents[index];
156 return WebInspector.TracingTimelineUIUtils.eventTitle(event, this._model ); 156 return WebInspector.TimelineUIUtils.eventTitle(event, this._model);
157 }, 157 },
158 158
159 /** 159 /**
160 * @override 160 * @override
161 * @param {number} index 161 * @param {number} index
162 * @return {boolean} 162 * @return {boolean}
163 */ 163 */
164 isTallMarker: function(index) 164 isTallMarker: function(index)
165 { 165 {
166 var event = this._markerEvents[index]; 166 var event = this._markerEvents[index];
167 return WebInspector.TracingTimelineUIUtils.isTallMarkerEvent(event); 167 return WebInspector.TimelineUIUtils.isTallMarkerEvent(event);
168 }, 168 },
169 169
170 reset: function() 170 reset: function()
171 { 171 {
172 this._timelineData = null; 172 this._timelineData = null;
173 /** @type {!Array.<!WebInspector.TracingModel.Event>} */ 173 /** @type {!Array.<!WebInspector.TracingModel.Event>} */
174 this._entryEvents = []; 174 this._entryEvents = [];
175 this._entryIndexToTitle = {}; 175 this._entryIndexToTitle = {};
176 this._markerEvents = []; 176 this._markerEvents = [];
177 this._entryIndexToFrame = {}; 177 this._entryIndexToFrame = {};
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 * @return {boolean} 223 * @return {boolean}
224 */ 224 */
225 _appendSyncEvents: function(headerName, events) 225 _appendSyncEvents: function(headerName, events)
226 { 226 {
227 var openEvents = []; 227 var openEvents = [];
228 var headerAppended = false; 228 var headerAppended = false;
229 229
230 var maxStackDepth = 0; 230 var maxStackDepth = 0;
231 for (var i = 0; i < events.length; ++i) { 231 for (var i = 0; i < events.length; ++i) {
232 var e = events[i]; 232 var e = events[i];
233 if (WebInspector.TracingTimelineUIUtils.isMarkerEvent(e)) { 233 if (WebInspector.TimelineUIUtils.isMarkerEvent(e)) {
234 this._markerEvents.push(e); 234 this._markerEvents.push(e);
235 this._timelineData.markerTimestamps.push(e.startTime); 235 this._timelineData.markerTimestamps.push(e.startTime);
236 } 236 }
237 if (!e.endTime && e.phase !== WebInspector.TracingModel.Phase.Instan t) 237 if (!e.endTime && e.phase !== WebInspector.TracingModel.Phase.Instan t)
238 continue; 238 continue;
239 if (WebInspector.TracingModel.isAsyncPhase(e.phase)) 239 if (WebInspector.TracingModel.isAsyncPhase(e.phase))
240 continue; 240 continue;
241 if (!this._isVisible(e)) 241 if (!this._isVisible(e))
242 continue; 242 continue;
243 while (openEvents.length && openEvents.peekLast().endTime <= e.start Time) 243 while (openEvents.length && openEvents.peekLast().endTime <= e.start Time)
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 * @param {number} entryIndex 460 * @param {number} entryIndex
461 * @return {string} 461 * @return {string}
462 */ 462 */
463 entryColor: function(entryIndex) 463 entryColor: function(entryIndex)
464 { 464 {
465 var event = this._entryEvents[entryIndex]; 465 var event = this._entryEvents[entryIndex];
466 if (!event) 466 if (!event)
467 return this._entryIndexToFrame[entryIndex] ? "white" : "#555"; 467 return this._entryIndexToFrame[entryIndex] ? "white" : "#555";
468 if (event.name === WebInspector.TracingTimelineModel.RecordType.JSFrame) 468 if (event.name === WebInspector.TracingTimelineModel.RecordType.JSFrame)
469 return this._timelineData.entryLevels[entryIndex] % 2 ? "#efb320" : "#fcc02d"; 469 return this._timelineData.entryLevels[entryIndex] % 2 ? "#efb320" : "#fcc02d";
470 var category = WebInspector.TracingTimelineUIUtils.eventStyle(event).cat egory; 470 var category = WebInspector.TimelineUIUtils.eventStyle(event).category;
471 if (WebInspector.TracingModel.isAsyncPhase(event.phase)) { 471 if (WebInspector.TracingModel.isAsyncPhase(event.phase)) {
472 if (event.category === WebInspector.TracingModel.ConsoleEventCategor y) 472 if (event.category === WebInspector.TracingModel.ConsoleEventCategor y)
473 return WebInspector.TimelineFlameChartDataProvider.consoleEvents ColorGenerator().colorForID(event.name); 473 return WebInspector.TimelineFlameChartDataProvider.consoleEvents ColorGenerator().colorForID(event.name);
474 var color = this._asyncColorByCategory[category.name]; 474 var color = this._asyncColorByCategory[category.name];
475 if (color) 475 if (color)
476 return color; 476 return color;
477 var parsedColor = WebInspector.Color.parse(category.fillColorStop1); 477 var parsedColor = WebInspector.Color.parse(category.fillColorStop1);
478 color = parsedColor.setAlpha(0.7).toString(WebInspector.Color.Format .RGBA) || ""; 478 color = parsedColor.setAlpha(0.7).toString(WebInspector.Color.Format .RGBA) || "";
479 this._asyncColorByCategory[category.name] = color; 479 this._asyncColorByCategory[category.name] = color;
480 return color; 480 return color;
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 /** 889 /**
890 * @constructor 890 * @constructor
891 * @param {!WebInspector.TimelineSelection} selection 891 * @param {!WebInspector.TimelineSelection} selection
892 * @param {number} entryIndex 892 * @param {number} entryIndex
893 */ 893 */
894 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex) 894 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex)
895 { 895 {
896 this.timelineSelection = selection; 896 this.timelineSelection = selection;
897 this.entryIndex = entryIndex; 897 this.entryIndex = entryIndex;
898 } 898 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineEventOverview.js ('k') | Source/devtools/front_end/timeline/TimelineFrameModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698