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

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

Issue 676663002: Paint Profiler: fix right boundary of selection window (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | no next file » | 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 (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 }, 171 },
172 172
173 _onWindowChanged: function() 173 _onWindowChanged: function()
174 { 174 {
175 this.dispatchEventToListeners(WebInspector.PaintProfilerView.Events.Wind owChanged); 175 this.dispatchEventToListeners(WebInspector.PaintProfilerView.Events.Wind owChanged);
176 176
177 // Update pie chart 177 // Update pie chart
178 var window = this.windowBoundaries(); 178 var window = this.windowBoundaries();
179 var totalTime = 0; 179 var totalTime = 0;
180 var timeByCategory = {}; 180 var timeByCategory = {};
181 for (var i = window.left; i <= window.right; ++i) { 181 for (var i = window.left; i < window.right; ++i) {
182 var logEntry = this._log[i]; 182 var logEntry = this._log[i];
183 var category = WebInspector.PaintProfilerView._categoryForLogItem(lo gEntry); 183 var category = WebInspector.PaintProfilerView._categoryForLogItem(lo gEntry);
184 timeByCategory[category.color] = timeByCategory[category.color] || 0 ; 184 timeByCategory[category.color] = timeByCategory[category.color] || 0 ;
185 for (var j = 0; j < this._profiles.length; ++j) { 185 for (var j = 0; j < this._profiles.length; ++j) {
186 var time = this._profiles[j][logEntry.commandIndex]; 186 var time = this._profiles[j][logEntry.commandIndex];
187 totalTime += time; 187 totalTime += time;
188 timeByCategory[category.color] += time; 188 timeByCategory[category.color] += time;
189 } 189 }
190 } 190 }
191 this._pieChart.setTotal(totalTime / this._profiles.length); 191 this._pieChart.setTotal(totalTime / this._profiles.length);
(...skipping 14 matching lines...) Expand all
206 return Number.millisToString(value * 1000, true); 206 return Number.millisToString(value * 1000, true);
207 }, 207 },
208 208
209 /** 209 /**
210 * @return {{left: number, right: number}} 210 * @return {{left: number, right: number}}
211 */ 211 */
212 windowBoundaries: function() 212 windowBoundaries: function()
213 { 213 {
214 var screenLeft = this._selectionWindow.windowLeft * this._canvas.width; 214 var screenLeft = this._selectionWindow.windowLeft * this._canvas.width;
215 var screenRight = this._selectionWindow.windowRight * this._canvas.width ; 215 var screenRight = this._selectionWindow.windowRight * this._canvas.width ;
216 var barLeft = Math.floor((screenLeft - this._barPaddingWidth) / this._ou terBarWidth); 216 var barLeft = Math.floor(screenLeft / this._outerBarWidth);
217 var barRight = Math.floor((screenRight - this._barPaddingWidth + this._i nnerBarWidth)/ this._outerBarWidth); 217 var barRight = Math.floor((screenRight + this._innerBarWidth - this._bar PaddingWidth / 2) / this._outerBarWidth);
218 var stepLeft = Number.constrain(barLeft * this._samplesPerBar, 0, this._ log.length - 1); 218 var stepLeft = Number.constrain(barLeft * this._samplesPerBar, 0, this._ log.length - 1);
219 var stepRight = Number.constrain(barRight * this._samplesPerBar, 0, this ._log.length - 1); 219 var stepRight = Number.constrain(barRight * this._samplesPerBar, 0, this ._log.length);
220 220
221 return { left: stepLeft, right: stepRight }; 221 return { left: stepLeft, right: stepRight };
222 }, 222 },
223 223
224 _updateImage: function() 224 _updateImage: function()
225 { 225 {
226 delete this._updateImageTimer; 226 delete this._updateImageTimer;
227 if (!this._profiles || !this._profiles.length) 227 if (!this._profiles || !this._profiles.length)
228 return; 228 return;
229 229
230 var window = this.windowBoundaries(); 230 var window = this.windowBoundaries();
231 this._snapshot.requestImage(this._log[window.left].commandIndex, this._l og[window.right].commandIndex, 1, this._showImageCallback); 231 this._snapshot.requestImage(this._log[window.left].commandIndex, this._l og[window.right - 1].commandIndex, 1, this._showImageCallback);
232 }, 232 },
233 233
234 _reset: function() 234 _reset: function()
235 { 235 {
236 this._snapshot = null; 236 this._snapshot = null;
237 this._profiles = null; 237 this._profiles = null;
238 this._selectionWindow.reset(); 238 this._selectionWindow.reset();
239 }, 239 },
240 240
241 __proto__: WebInspector.HBox.prototype 241 __proto__: WebInspector.HBox.prototype
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 /** 284 /**
285 * @param {number=} stepLeft 285 * @param {number=} stepLeft
286 * @param {number=} stepRight 286 * @param {number=} stepRight
287 */ 287 */
288 updateWindow: function(stepLeft, stepRight) 288 updateWindow: function(stepLeft, stepRight)
289 { 289 {
290 this.sidebarTree.removeChildren(); 290 this.sidebarTree.removeChildren();
291 if (!this._log) 291 if (!this._log)
292 return; 292 return;
293 stepLeft = stepLeft || 0; 293 stepLeft = stepLeft || 0;
294 stepRight = stepRight || this._log.length - 1; 294 stepRight = stepRight || this._log.length;
295 for (var i = stepLeft; i <= stepRight; ++i) 295 for (var i = stepLeft; i < stepRight; ++i)
296 this._appendLogItem(this.sidebarTree, this._log[i]); 296 this._appendLogItem(this.sidebarTree, this._log[i]);
297 }, 297 },
298 298
299 _reset: function() 299 _reset: function()
300 { 300 {
301 this._log = []; 301 this._log = [];
302 }, 302 },
303 303
304 /** 304 /**
305 * @param {?Event} event 305 * @param {?Event} event
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 var method = logItem.method.toTitleCase(); 581 var method = logItem.method.toTitleCase();
582 582
583 var logItemCategories = WebInspector.PaintProfilerView._initLogItemCategorie s(); 583 var logItemCategories = WebInspector.PaintProfilerView._initLogItemCategorie s();
584 var result = logItemCategories[method]; 584 var result = logItemCategories[method];
585 if (!result) { 585 if (!result) {
586 result = WebInspector.PaintProfilerView.categories()["misc"]; 586 result = WebInspector.PaintProfilerView.categories()["misc"];
587 logItemCategories[method] = result; 587 logItemCategories[method] = result;
588 } 588 }
589 return result; 589 return result;
590 } 590 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698