Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/product_registry/ProductRegistry.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/product_registry/ProductRegistry.js b/third_party/WebKit/Source/devtools/front_end/product_registry/ProductRegistry.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..92ca9ba58b75328ef29053cc4d861235e27ea2f6 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/devtools/front_end/product_registry/ProductRegistry.js |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| +/** |
| + * @return {!Promise<!ProductRegistry.Registry>} |
| + */ |
| +ProductRegistry.instance = function() { |
| + if (ProductRegistry._instancePromise) |
|
pfeldman
2017/04/27 22:20:49
Replace all this text with:
return self.runtime.e
allada
2017/04/28 01:20:07
Done.
|
| + return ProductRegistry._instancePromise; |
| + /** @type {!Promise<!ProductRegistry.Registry>} */ |
| + ProductRegistry._instancePromise = self.runtime.extension(ProductRegistry.Registry).instance().then(instance => { |
| + ProductRegistry._instance = instance; |
| + return instance; |
| + }); |
| + return ProductRegistry._instancePromise; |
| +}; |
| + |
| +/** |
| + * @return {?ProductRegistry.Registry} |
| + */ |
| +ProductRegistry.existingInstance = function() { |
|
pfeldman
2017/04/27 22:20:49
You should not need this.
allada
2017/04/28 01:20:07
Done.
|
| + return ProductRegistry._instance; |
| +}; |
| + |
| +/** @type {?Promise<!ProductRegistry.Registry>} */ |
| +ProductRegistry._instancePromise = null; |
|
pfeldman
2017/04/27 22:20:49
drop these.
allada
2017/04/28 01:20:07
Done.
|
| + |
| +/** @type {?ProductRegistry.Registry} */ |
| +ProductRegistry._instance = null; |
| + |
| +/** |
| + * @interface |
| + */ |
| +ProductRegistry.Registry = function() {}; |
| + |
| +ProductRegistry.Registry.prototype = { |
| + /** |
| + * @param {!Common.ParsedURL} parsedUrl |
| + * @return {?string} |
| + */ |
| + nameForUrl: function(parsedUrl) {}, |
| + |
| + /** |
| + * @param {!Common.ParsedURL} parsedUrl |
| + * @return {?ProductRegistry.Registry.ProductEntry} |
| + */ |
| + entryForUrl: function(parsedUrl) {}, |
| + |
| + /** |
| + * @param {!Common.ParsedURL} parsedUrl |
| + * @return {?number} |
| + */ |
| + typeForUrl: function(parsedUrl) {}, |
| + |
| + /** |
| + * @param {!SDK.ResourceTreeFrame} frame |
| + * @return {?ProductRegistry.Registry.ProductEntry} |
| + */ |
| + entryForFrame: function(frame) {} |
| +}; |
| + |
| +/** @typedef {!{name: string, type: ?number}} */ |
| +ProductRegistry.Registry.ProductEntry; |