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

Unified Diff: Source/devtools/front_end/elements/StylesSidebarPane.js

Issue 1285183006: DevTools: WI.Throttler goes promisified. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cc
Patch Set: remove dependent patchset Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/elements/StylesSidebarPane.js
diff --git a/Source/devtools/front_end/elements/StylesSidebarPane.js b/Source/devtools/front_end/elements/StylesSidebarPane.js
index dffd02758e605be13bb481f15cc28e4c7bc238da..6ba5681be5c60907561eefc1d2e4149ee8cb997b 100644
--- a/Source/devtools/front_end/elements/StylesSidebarPane.js
+++ b/Source/devtools/front_end/elements/StylesSidebarPane.js
@@ -313,16 +313,14 @@ WebInspector.StylesSidebarPane.prototype = {
/**
* @override
- * @param {!WebInspector.Throttler.FinishCallback} finishedCallback
+ * @return {!Promise.<?>}
*/
- doUpdate: function(finishedCallback)
+ doUpdate: function()
{
this._discardElementUnderMouse();
- this.fetchMatchedCascade()
+ return this.fetchMatchedCascade()
.then(this._innerRebuildUpdate.bind(this))
- .then(finishedCallback)
- .catch(/** @type {function()} */(finishedCallback));
},
_resetCache: function()
@@ -2804,14 +2802,12 @@ WebInspector.StylePropertyTreeElement.prototype = {
/**
* @param {string} styleText
* @param {boolean} majorChange
- * @param {!WebInspector.Throttler.FinishCallback} finishedCallback
+ * @return {!Promise.<undefined>}
*/
- _innerApplyStyleText: function(styleText, majorChange, finishedCallback)
+ _innerApplyStyleText: function(styleText, majorChange)
{
- if (!this.treeOutline) {
- finishedCallback();
- return;
- }
+ if (!this.treeOutline)
+ return Promise.resolve();
styleText = styleText.replace(/\s/g, " ").trim(); // Replace &nbsp; with whitespace.
if (!styleText.length && majorChange && this._newProperty && !this._propertyHasBeenEditedIncrementally) {
@@ -2819,7 +2815,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
var section = this.section();
this.parent.removeChild(this);
section.afterUpdate();
- return;
+ return Promise.resolve();
}
var currentNode = this._parentPane.node();
@@ -2838,7 +2834,6 @@ WebInspector.StylePropertyTreeElement.prototype = {
// It did not apply, cancel editing.
this._revertStyleUponEditingCanceled();
}
- finishedCallback();
this.styleTextAppliedForTest();
return;
}
@@ -2851,7 +2846,6 @@ WebInspector.StylePropertyTreeElement.prototype = {
if (!this._parentPane._isEditingStyle && currentNode === this.node())
this._updatePane();
- finishedCallback();
this.styleTextAppliedForTest();
}
@@ -2860,9 +2854,8 @@ WebInspector.StylePropertyTreeElement.prototype = {
if (styleText.length && !/;\s*$/.test(styleText))
styleText += ";";
var overwriteProperty = !this._newProperty || this._propertyHasBeenEditedIncrementally;
- this.property.setText(styleText, majorChange, overwriteProperty)
- .then(callback.bind(this))
- .catch(/** @type {function()} */(finishedCallback));
+ return this.property.setText(styleText, majorChange, overwriteProperty)
+ .then(callback.bind(this));
},
/**
« no previous file with comments | « Source/devtools/front_end/elements/PropertiesWidget.js ('k') | Source/devtools/front_end/emulation/MediaQueryInspector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698