| 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;
|
| +}
|
|
|