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

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

Issue 1163223003: DevTools: better error handling in paint profiler UI (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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) 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 setSnapshotAndLog: function(snapshot, log, clipRect) 77 setSnapshotAndLog: function(snapshot, log, clipRect)
78 { 78 {
79 this._reset(); 79 this._reset();
80 this._snapshot = snapshot; 80 this._snapshot = snapshot;
81 this._log = log; 81 this._log = log;
82 this._logCategories = this._log.map(WebInspector.PaintProfilerView._cate goryForLogItem); 82 this._logCategories = this._log.map(WebInspector.PaintProfilerView._cate goryForLogItem);
83 83
84 if (!this._snapshot) { 84 if (!this._snapshot) {
85 this._update(); 85 this._update();
86 this._pieChart.setTotal(0); 86 this._pieChart.setTotal(0);
87 this._selectionWindow.setEnabled(false);
87 return; 88 return;
88 } 89 }
90 this._selectionWindow.setEnabled(true);
89 this._progressBanner.classList.remove("hidden"); 91 this._progressBanner.classList.remove("hidden");
90 snapshot.requestImage(null, null, 1, this._showImageCallback); 92 snapshot.requestImage(null, null, 1, this._showImageCallback);
91 snapshot.profile(clipRect, onProfileDone.bind(this)); 93 snapshot.profile(clipRect, onProfileDone.bind(this));
92 /** 94 /**
93 * @param {!Array.<!LayerTreeAgent.PaintProfile>=} profiles 95 * @param {!Array.<!LayerTreeAgent.PaintProfile>=} profiles
94 * @this {WebInspector.PaintProfilerView} 96 * @this {WebInspector.PaintProfilerView}
95 */ 97 */
96 function onProfileDone(profiles) 98 function onProfileDone(profiles)
97 { 99 {
98 this._progressBanner.classList.add("hidden"); 100 this._progressBanner.classList.add("hidden");
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 this._treeOutline.element.addEventListener("mousemove", this._onMouseMove.bi nd(this), false); 266 this._treeOutline.element.addEventListener("mousemove", this._onMouseMove.bi nd(this), false);
265 this._treeOutline.element.addEventListener("mouseout", this._onMouseMove.bin d(this), false); 267 this._treeOutline.element.addEventListener("mouseout", this._onMouseMove.bin d(this), false);
266 this._treeOutline.element.addEventListener("contextmenu", this._onContextMen u.bind(this), true); 268 this._treeOutline.element.addEventListener("contextmenu", this._onContextMen u.bind(this), true);
267 269
268 this._reset(); 270 this._reset();
269 } 271 }
270 272
271 WebInspector.PaintProfilerCommandLogView.prototype = { 273 WebInspector.PaintProfilerCommandLogView.prototype = {
272 /** 274 /**
273 * @param {?WebInspector.Target} target 275 * @param {?WebInspector.Target} target
274 * @param {!Array.<!WebInspector.PaintProfilerLogItem>=} log 276 * @param {!Array.<!WebInspector.PaintProfilerLogItem>} log
275 */ 277 */
276 setCommandLog: function(target, log) 278 setCommandLog: function(target, log)
277 { 279 {
278 this._target = target; 280 this._target = target;
279 this._log = log; 281 this._log = log;
280 this.updateWindow(); 282 this.updateWindow();
281 }, 283 },
282 284
283 /** 285 /**
284 * @param {!TreeOutline} treeOutline 286 * @param {!TreeOutline} treeOutline
285 * @param {!WebInspector.PaintProfilerLogItem} logItem 287 * @param {!WebInspector.PaintProfilerLogItem} logItem
286 */ 288 */
287 _appendLogItem: function(treeOutline, logItem) 289 _appendLogItem: function(treeOutline, logItem)
288 { 290 {
289 var treeElement = new WebInspector.LogTreeElement(this, logItem); 291 var treeElement = new WebInspector.LogTreeElement(this, logItem);
290 treeOutline.appendChild(treeElement); 292 treeOutline.appendChild(treeElement);
291 }, 293 },
292 294
293 /** 295 /**
294 * @param {number=} stepLeft 296 * @param {number=} stepLeft
295 * @param {number=} stepRight 297 * @param {number=} stepRight
296 */ 298 */
297 updateWindow: function(stepLeft, stepRight) 299 updateWindow: function(stepLeft, stepRight)
298 { 300 {
299 this._treeOutline.removeChildren(); 301 this._treeOutline.removeChildren();
300 if (!this._log) 302 if (!this._log.length)
301 return; 303 return;
302 stepLeft = stepLeft || 0; 304 stepLeft = stepLeft || 0;
303 stepRight = stepRight || this._log.length; 305 stepRight = stepRight || this._log.length;
304 for (var i = stepLeft; i < stepRight; ++i) 306 for (var i = stepLeft; i < stepRight; ++i)
305 this._appendLogItem(this._treeOutline, this._log[i]); 307 this._appendLogItem(this._treeOutline, this._log[i]);
306 }, 308 },
307 309
308 _reset: function() 310 _reset: function()
309 { 311 {
310 this._log = []; 312 this._log = [];
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 var method = logItem.method.toTitleCase(); 586 var method = logItem.method.toTitleCase();
585 587
586 var logItemCategories = WebInspector.PaintProfilerView._initLogItemCategorie s(); 588 var logItemCategories = WebInspector.PaintProfilerView._initLogItemCategorie s();
587 var result = logItemCategories[method]; 589 var result = logItemCategories[method];
588 if (!result) { 590 if (!result) {
589 result = WebInspector.PaintProfilerView.categories()["misc"]; 591 result = WebInspector.PaintProfilerView.categories()["misc"];
590 logItemCategories[method] = result; 592 logItemCategories[method] = result;
591 } 593 }
592 return result; 594 return result;
593 } 595 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698