| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Services.ServiceManager = class { | 7 Services.ServiceManager = class { |
| 8 /** | 8 /** |
| 9 * @param {string} serviceName | 9 * @param {string} serviceName |
| 10 * @return {!Promise<?Services.ServiceManager.Service>} | 10 * @return {!Promise<?Services.ServiceManager.Service>} |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * @param {string} appName | 26 * @param {string} appName |
| 27 * @param {string} serviceName | 27 * @param {string} serviceName |
| 28 * @param {boolean} isSharedWorker | 28 * @param {boolean} isSharedWorker |
| 29 * @return {!Promise<?Services.ServiceManager.Service>} | 29 * @return {!Promise<?Services.ServiceManager.Service>} |
| 30 */ | 30 */ |
| 31 createAppService(appName, serviceName, isSharedWorker) { | 31 createAppService(appName, serviceName, isSharedWorker) { |
| 32 var url = appName + '.js'; | 32 var url = appName + '.js'; |
| 33 var remoteBase = Runtime.queryParam('remoteBase'); | 33 var remoteBase = Runtime.queryParam('remoteBase'); |
| 34 var debugFrontend = Runtime.queryParam('debugFrontend'); |
| 34 // Do not pass additional query parameters to shared worker to avoid URLMism
atchError | 35 // Do not pass additional query parameters to shared worker to avoid URLMism
atchError |
| 35 // in case another instance of DevTools with different remoteBase creates sa
me shared worker. | 36 // in case another instance of DevTools with different query parameters crea
tes same shared worker. |
| 36 if (remoteBase && !isSharedWorker) | 37 if (remoteBase && !isSharedWorker) |
| 37 url += '?remoteBase=' + remoteBase; | 38 url += '?remoteBase=' + remoteBase; |
| 39 if (debugFrontend && !isSharedWorker) |
| 40 url += '?debugFrontend=' + debugFrontend; |
| 38 | 41 |
| 39 var worker = isSharedWorker ? new SharedWorker(url, appName) : new Worker(ur
l); | 42 var worker = isSharedWorker ? new SharedWorker(url, appName) : new Worker(ur
l); |
| 40 var connection = new Services.ServiceManager.Connection(new Services.Service
Manager.WorkerServicePort(worker)); | 43 var connection = new Services.ServiceManager.Connection(new Services.Service
Manager.WorkerServicePort(worker)); |
| 41 return connection._createService(serviceName); | 44 return connection._createService(serviceName); |
| 42 } | 45 } |
| 43 }; | 46 }; |
| 44 | 47 |
| 45 /** | 48 /** |
| 46 * @unrestricted | 49 * @unrestricted |
| 47 */ | 50 */ |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 close() { | 371 close() { |
| 369 return this._workerPromise.then(() => { | 372 return this._workerPromise.then(() => { |
| 370 if (this._worker) | 373 if (this._worker) |
| 371 this._worker.terminate(); | 374 this._worker.terminate(); |
| 372 return false; | 375 return false; |
| 373 }); | 376 }); |
| 374 } | 377 } |
| 375 }; | 378 }; |
| 376 | 379 |
| 377 Services.serviceManager = new Services.ServiceManager(); | 380 Services.serviceManager = new Services.ServiceManager(); |
| OLD | NEW |