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

Unified Diff: third_party/WebKit/Source/devtools/front_end/platform/utilities.js

Issue 2861053003: DevTools: [lighthouse] Implement performance metrics filmstrip (Closed)
Patch Set: test fixed Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/emulation/InspectedPagePlaceholder.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/platform/utilities.js
diff --git a/third_party/WebKit/Source/devtools/front_end/platform/utilities.js b/third_party/WebKit/Source/devtools/front_end/platform/utilities.js
index cea60fb5c5a31d684ae2ce86d5b13d69ade5b0a3..14f5d3aa303744586a5d7480c62cf783f7b71390 100644
--- a/third_party/WebKit/Source/devtools/front_end/platform/utilities.js
+++ b/third_party/WebKit/Source/devtools/front_end/platform/utilities.js
@@ -1444,3 +1444,18 @@ function runOnWindowLoad(callback) {
else
self.addEventListener('DOMContentLoaded', windowLoaded, false);
}
+
+var _singletonSymbol = Symbol('singleton');
+
+/**
+ * @template T
+ * @param {function(new:T, ...)} constructorFunction
+ * @return {!T}
+ */
+function singleton(constructorFunction) {
+ if (_singletonSymbol in constructorFunction)
+ return constructorFunction[_singletonSymbol];
+ var instance = new constructorFunction();
+ constructorFunction[_singletonSymbol] = instance;
+ return instance;
+}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/emulation/InspectedPagePlaceholder.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698