Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js b/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js |
| index 5512e77ffca6674c6b99b2751b140999d6b3aaa6..fe4ff440426e7f92706798151ad600cd8c72b3ae 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js |
| @@ -140,7 +140,7 @@ ServiceDispatcher.prototype = { |
| /** |
| * @constructor |
| - * @param {!Port} port |
| + * @param {!Port|!Worker} port |
| * @implements {ServicePort} |
| */ |
| function WorkerServicePort(port) |
| @@ -200,6 +200,22 @@ var services = new Map(); |
| * @param {string} serviceName |
| * @param {function(new:Service)} constructor |
| */ |
| +function initializeWorkerService(serviceName, constructor) |
| +{ |
| + services.set(serviceName, constructor); |
| + if (!dispatchers.length) { |
| + var worker = /** @type {!Object} */(self); |
|
dgozman
2016/10/14 03:14:58
@type {!Worker}
pfeldman
2016/10/14 17:29:20
JSCompiler won't let you do that...
|
| + var servicePort = new WorkerServicePort(/** @type {!Worker} */(worker)); |
| + var dispatcher = new ServiceDispatcher(servicePort); |
| + dispatchers.push(dispatcher); |
| + } |
| + dispatchers[0].registerObject(serviceName, constructor); |
| +} |
| + |
| +/** |
| + * @param {string} serviceName |
| + * @param {function(new:Service)} constructor |
| + */ |
| function initializeSharedWorkerService(serviceName, constructor) |
| { |
| services.set(serviceName, constructor); |