Chromium Code Reviews| 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 if (remoteBase) | 34 // 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 if (remoteBase && !isSharedWorker) | |
| 35 url += '?remoteBase=' + remoteBase; | 37 url += '?remoteBase=' + remoteBase; |
| 36 | 38 |
| 37 var worker = isSharedWorker ? new SharedWorker(url, appName) : new Worker(ur l); | 39 var worker = isSharedWorker ? new SharedWorker(url, appName) : new Worker(ur l); |
|
dgozman
2016/12/02 19:55:53
Should we instead pass different appName for diffe
| |
| 38 var connection = new Services.ServiceManager.Connection(new Services.Service Manager.WorkerServicePort(worker)); | 40 var connection = new Services.ServiceManager.Connection(new Services.Service Manager.WorkerServicePort(worker)); |
| 39 return connection._createService(serviceName); | 41 return connection._createService(serviceName); |
| 40 } | 42 } |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 /** | 45 /** |
| 44 * @unrestricted | 46 * @unrestricted |
| 45 */ | 47 */ |
| 46 Services.ServiceManager.Connection = class { | 48 Services.ServiceManager.Connection = class { |
| 47 /** | 49 /** |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 close() { | 368 close() { |
| 367 return this._workerPromise.then(() => { | 369 return this._workerPromise.then(() => { |
| 368 if (this._worker) | 370 if (this._worker) |
| 369 this._worker.terminate(); | 371 this._worker.terminate(); |
| 370 return false; | 372 return false; |
| 371 }); | 373 }); |
| 372 } | 374 } |
| 373 }; | 375 }; |
| 374 | 376 |
| 375 Services.serviceManager = new Services.ServiceManager(); | 377 Services.serviceManager = new Services.ServiceManager(); |
| OLD | NEW |