diff options
author | caseq@chromium.org <caseq@chromium.org> | 2015-06-08 10:26:07 +0000 |
---|---|---|
committer | caseq@chromium.org <caseq@chromium.org> | 2015-06-08 10:26:07 +0000 |
commit | 4ad631bc4443438c89b92be2f7df33392cf5f316 (patch) | |
tree | bf20080d5922e125ec7a5030449c856758e32ee0 /third_party | |
parent | da7ff7586bf8412508c638be9166cf7573d2c8d3 (diff) | |
download | chromium_src-4ad631bc4443438c89b92be2f7df33392cf5f316.zip chromium_src-4ad631bc4443438c89b92be2f7df33392cf5f316.tar.gz chromium_src-4ad631bc4443438c89b92be2f7df33392cf5f316.tar.bz2 |
DevTools: better error handling in paint profiler UI
Avoid exception when displaying an empty paint command list.
BUG=
Review URL: https://codereview.chromium.org/1163223003
git-svn-id: svn://svn.chromium.org/blink/trunk@196664 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party')
4 files changed, 15 insertions, 10 deletions
diff --git a/third_party/WebKit/Source/devtools/front_end/layers/LayerPaintProfilerView.js b/third_party/WebKit/Source/devtools/front_end/layers/LayerPaintProfilerView.js index ccd39f74..c94d480 100644 --- a/third_party/WebKit/Source/devtools/front_end/layers/LayerPaintProfilerView.js +++ b/third_party/WebKit/Source/devtools/front_end/layers/LayerPaintProfilerView.js @@ -47,7 +47,7 @@ WebInspector.LayerPaintProfilerView.prototype = { */ function onCommandLogDone(snapshot, log) { - this._logTreeView.setCommandLog(snapshot.target(), log); + this._logTreeView.setCommandLog(snapshot.target(), log || []); this._paintProfilerView.setSnapshotAndLog(snapshot || null, log || [], null); } }, diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/PaintProfilerView.js b/third_party/WebKit/Source/devtools/front_end/timeline/PaintProfilerView.js index c3b61b9..fd7a093 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/PaintProfilerView.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/PaintProfilerView.js @@ -84,8 +84,10 @@ WebInspector.PaintProfilerView.prototype = { if (!this._snapshot) { this._update(); this._pieChart.setTotal(0); + this._selectionWindow.setEnabled(false); return; } + this._selectionWindow.setEnabled(true); this._progressBanner.classList.remove("hidden"); snapshot.requestImage(null, null, 1, this._showImageCallback); snapshot.profile(clipRect, onProfileDone.bind(this)); @@ -271,7 +273,7 @@ WebInspector.PaintProfilerCommandLogView = function() WebInspector.PaintProfilerCommandLogView.prototype = { /** * @param {?WebInspector.Target} target - * @param {!Array.<!WebInspector.PaintProfilerLogItem>=} log + * @param {!Array.<!WebInspector.PaintProfilerLogItem>} log */ setCommandLog: function(target, log) { @@ -297,7 +299,7 @@ WebInspector.PaintProfilerCommandLogView.prototype = { updateWindow: function(stepLeft, stepRight) { this._treeOutline.removeChildren(); - if (!this._log) + if (!this._log.length) return; stepLeft = stepLeft || 0; stepRight = stepRight || this._log.length; diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js index d206a89..a1a478c 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js @@ -92,8 +92,10 @@ WebInspector.TimelinePaintProfilerView.prototype = { this._disposeSnapshot(); this._lastLoadedSnapshot = snapshot; this._imageView.setMask(tileRect); - if (!snapshot) + if (!snapshot) { + this._imageView.showImage(); return; + } snapshot.commandLog(onCommandLogDone.bind(this, snapshot, tileRect)); } @@ -105,7 +107,7 @@ WebInspector.TimelinePaintProfilerView.prototype = { */ function onCommandLogDone(snapshot, clipRect, log) { - this._logTreeView.setCommandLog(snapshot.target(), log); + this._logTreeView.setCommandLog(snapshot.target(), log || []); this._paintProfilerView.setSnapshotAndLog(snapshot, log || [], clipRect); } }, @@ -193,7 +195,8 @@ WebInspector.TimelinePaintImageView.prototype = { showImage: function(imageURL) { this._imageContainer.classList.toggle("hidden", !imageURL); - this._imageElement.src = imageURL; + if (imageURL) + this._imageElement.src = imageURL; }, /** diff --git a/third_party/WebKit/Source/devtools/front_end/ui_lazy/OverviewGrid.js b/third_party/WebKit/Source/devtools/front_end/ui_lazy/OverviewGrid.js index e6ccddd..3285813 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui_lazy/OverviewGrid.js +++ b/third_party/WebKit/Source/devtools/front_end/ui_lazy/OverviewGrid.js @@ -130,7 +130,7 @@ WebInspector.OverviewGrid.prototype = { */ setResizeEnabled: function(enabled) { - this._window._setEnabled(!!enabled); + this._window.setEnabled(!!enabled); } } @@ -178,7 +178,7 @@ WebInspector.OverviewGrid.Window = function(parentElement, dividersLabelBarEleme this._rightResizeElement = parentElement.createChild("div", "overview-grid-window-resizer overview-grid-window-resizer-right"); this._rightResizeElement.style.right = 0; WebInspector.installDragHandle(this._rightResizeElement, this._resizerElementStartDragging.bind(this), this._rightResizeElementDragging.bind(this), null, "ew-resize"); - this._setEnabled(true); + this.setEnabled(true); } WebInspector.OverviewGrid.Events = { @@ -198,13 +198,13 @@ WebInspector.OverviewGrid.Window.prototype = { this._overviewWindowBordersElement.style.right = "0%"; this._leftResizeElement.style.left = "0%"; this._rightResizeElement.style.left = "100%"; - this._setEnabled(true); + this.setEnabled(true); }, /** * @param {boolean} enabled */ - _setEnabled: function(enabled) + setEnabled: function(enabled) { enabled = !!enabled; if (this._enabled === enabled) |