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

Unified Diff: Source/devtools/front_end/emulation/OverridesSupport.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/emulation/OverridesSupport.js
diff --git a/Source/devtools/front_end/emulation/OverridesSupport.js b/Source/devtools/front_end/emulation/OverridesSupport.js
index cfaeddda131b61b432427a98bd763e0794b0c46d..59102f1a0fab65f17d54d32ba0beac6c47ec2313 100644
--- a/Source/devtools/front_end/emulation/OverridesSupport.js
+++ b/Source/devtools/front_end/emulation/OverridesSupport.js
@@ -603,30 +603,27 @@ WebInspector.OverridesSupport.prototype = {
this._deviceMetricsThrottler.schedule(setDeviceMetricsOverride.bind(this));
/**
- * @param {!WebInspector.Throttler.FinishCallback} finishCallback
* @this {WebInspector.OverridesSupport}
+ * @return {!Promise.<undefined>}
*/
- function setDeviceMetricsOverride(finishCallback)
+ function setDeviceMetricsOverride()
{
- this._target.emulationAgent().setDeviceMetricsOverride(
+ var promise = this._target.emulationAgent().setDeviceMetricsOverride(
overrideWidth, overrideHeight, this.settings.emulateResolution.get() ? this.settings.deviceScaleFactor.get() : 0,
this.settings.emulateMobile.get(), this._pageResizer ? false : this.settings.deviceFitWindow.get(), scale, 0, 0,
screenWidth, screenHeight, positionX, positionY, apiCallback.bind(this))
- .then(finishCallback)
- .catch(/** @type {function()} */(finishCallback));
if (resetScrollAndPageScale)
this._target.emulationAgent().resetScrollAndPageScaleFactor();
+ return promise;
}
/**
- * @param {!WebInspector.Throttler.FinishCallback} finishCallback
* @this {WebInspector.OverridesSupport}
+ * @return {!Promise.<undefined>}
*/
- function clearDeviceMetricsOverride(finishCallback)
+ function clearDeviceMetricsOverride()
{
- this._target.emulationAgent().clearDeviceMetricsOverride(apiCallback.bind(this))
- .then(finishCallback)
- .catch(/** @type {function()} */(finishCallback));
+ return this._target.emulationAgent().clearDeviceMetricsOverride(apiCallback.bind(this))
}
/**

Powered by Google App Engine
This is Rietveld 408576698