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

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

Issue 402113002: Draw marker events on Timeline flame chart (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 (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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 /** 109 /**
110 * @param {number} startTime 110 * @param {number} startTime
111 * @param {number} endTime 111 * @param {number} endTime
112 * @return {?Array.<number>} 112 * @return {?Array.<number>}
113 */ 113 */
114 dividerOffsets: function(startTime, endTime) 114 dividerOffsets: function(startTime, endTime)
115 { 115 {
116 return null; 116 return null;
117 }, 117 },
118 118
119 /**
120 * @param {number} startTime
121 * @param {number} endTime
122 * @return {?Array.<!WebInspector.FlameChartDataProvider.Marker>}
123 */
124 timelineMarkers: function(startTime, endTime)
125 {
126 function compare(time, event)
127 {
128 return time - event.startTime;
129 }
130 var left = this._markerEvents.lowerBound(startTime, compare);
131 var right = this._markerEvents.upperBound(endTime, compare);
132 var result = [];
133 for (var i = left; i < right; i++) {
134 var event = this._markerEvents[i];
135 var title = WebInspector.TracingTimelineUIUtils.eventTitle(event, th is._model);
136 var color = WebInspector.TimelineUIUtilsImpl.markerEventColor(event. name);
137 result.push(new WebInspector.FlameChartDataProvider.Marker(event.sta rtTime, title, color));
138 }
139 return result;
140 },
141
119 reset: function() 142 reset: function()
120 { 143 {
121 this._timelineData = null; 144 this._timelineData = null;
122 /** @type {!Array.<!WebInspector.TracingModel.Event>} */ 145 /** @type {!Array.<!WebInspector.TracingModel.Event>} */
123 this._entryEvents = []; 146 this._entryEvents = [];
124 this._entryIndexToTitle = {}; 147 this._entryIndexToTitle = {};
148 this._markerEvents = [];
125 }, 149 },
126 150
127 /** 151 /**
128 * @return {!WebInspector.FlameChart.TimelineData} 152 * @return {!WebInspector.FlameChart.TimelineData}
129 */ 153 */
130 timelineData: function() 154 timelineData: function()
131 { 155 {
132 if (this._timelineData) 156 if (this._timelineData)
133 return this._timelineData; 157 return this._timelineData;
134 158
(...skipping 26 matching lines...) Expand all
161 { 185 {
162 var maxStackDepth = 0; 186 var maxStackDepth = 0;
163 var openEvents = []; 187 var openEvents = [];
164 var levels = []; 188 var levels = [];
165 var jsHeights = []; 189 var jsHeights = [];
166 var headerAppended = false; 190 var headerAppended = false;
167 var level = 0; 191 var level = 0;
168 var jsStackHeight = 0; 192 var jsStackHeight = 0;
169 for (var i = 0; i < events.length; ++i) { 193 for (var i = 0; i < events.length; ++i) {
170 var e = events[i]; 194 var e = events[i];
171 if (!e.endTime && e.phase !== WebInspector.TracingModel.Phase.Instan t) 195 if (!e.endTime && e.phase !== WebInspector.TracingModel.Phase.Instan t && e.phase !== "I")
alph 2014/07/21 12:05:30 && e.phase !== "I" seems to be not needed anymore.
yurys 2014/07/21 13:49:48 Done.
172 continue; 196 continue;
197 if (WebInspector.TracingTimelineUIUtils.isMarkerEvent(e))
198 this._markerEvents.push(e);
173 if (!this._isVisible(e)) 199 if (!this._isVisible(e))
174 continue; 200 continue;
175 while (openEvents.length && openEvents.peekLast().endTime <= e.start Time) { 201 while (openEvents.length && openEvents.peekLast().endTime <= e.start Time) {
176 openEvents.pop(); 202 openEvents.pop();
177 level = levels.pop(); 203 level = levels.pop();
178 jsStackHeight = jsHeights.pop(); 204 jsStackHeight = jsHeights.pop();
179 } 205 }
180 if (!headerAppended) { 206 if (!headerAppended) {
181 this._appendHeaderRecord(headerName, this._currentLevel); 207 this._appendHeaderRecord(headerName, this._currentLevel);
182 ++level; 208 ++level;
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 /** 651 /**
626 * @constructor 652 * @constructor
627 * @param {!WebInspector.TimelineSelection} selection 653 * @param {!WebInspector.TimelineSelection} selection
628 * @param {number} entryIndex 654 * @param {number} entryIndex
629 */ 655 */
630 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex) 656 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex)
631 { 657 {
632 this.timelineSelection = selection; 658 this.timelineSelection = selection;
633 this.entryIndex = entryIndex; 659 this.entryIndex = entryIndex;
634 } 660 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698