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

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

Issue 1204393002: DevTools: [CSS] promisify CSSStyleModel fetching methods (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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/elements/PlatformFontsWidget.js
diff --git a/Source/devtools/front_end/elements/PlatformFontsWidget.js b/Source/devtools/front_end/elements/PlatformFontsWidget.js
index 44ee32cebdfab146ca81ee367be523bee144e228..315c31eac55b6b68ec8f64c47dccc2860791c38b 100644
--- a/Source/devtools/front_end/elements/PlatformFontsWidget.js
+++ b/Source/devtools/front_end/elements/PlatformFontsWidget.js
@@ -71,29 +71,28 @@ WebInspector.PlatformFontsWidget.prototype = {
finishedCallback();
return;
}
- cssModel.getPlatformFontsForNode(node.id, this._refreshUI.bind(this, node, finishedCallback));
+ cssModel.platformFontsPromise(node.id)
+ .then(this._refreshUI.bind(this, node))
+ .then(finishedCallback)
+ .catch(/** @type {function()} */(finishedCallback));
},
/**
* @param {!WebInspector.DOMNode} node
- * @param {!WebInspector.Throttler.FinishCallback} finishedCallback
* @param {?Array.<!CSSAgent.PlatformFontUsage>} platformFonts
*/
- _refreshUI: function(node, finishedCallback, platformFonts)
+ _refreshUI: function(node, platformFonts)
{
- if (this._sharedModel.node() !== node) {
- finishedCallback();
+ if (this._sharedModel.node() !== node)
return;
- }
this._fontStatsSection.removeChildren();
var isEmptySection = !platformFonts || !platformFonts.length;
this._sectionTitle.classList.toggle("hidden", isEmptySection);
- if (isEmptySection) {
- finishedCallback();
+ if (isEmptySection)
return;
- }
+
platformFonts.sort(function (a, b) {
return b.glyphCount - a.glyphCount;
});
@@ -110,7 +109,6 @@ WebInspector.PlatformFontsWidget.prototype = {
var usage = platformFonts[i].glyphCount;
fontUsageElement.textContent = usage === 1 ? WebInspector.UIString("%d glyph", usage) : WebInspector.UIString("%d glyphs", usage);
}
- finishedCallback();
},
__proto__: WebInspector.ThrottledWidget.prototype

Powered by Google App Engine
This is Rietveld 408576698