| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Only pause new worker if debugging SW - we are going through the | 105 // Only pause new worker if debugging SW - we are going through the |
| 106 // pause on start checkbox. | 106 // pause on start checkbox. |
| 107 var mainIsServiceWorker = WebInspector.targetManager.mainTarget().hasWor
kerCapability() && !WebInspector.targetManager.mainTarget().hasBrowserCapability
(); | 107 var mainIsServiceWorker = WebInspector.targetManager.mainTarget().hasWor
kerCapability() && !WebInspector.targetManager.mainTarget().hasBrowserCapability
(); |
| 108 if (mainIsServiceWorker && waitingForDebugger) | 108 if (mainIsServiceWorker && waitingForDebugger) |
| 109 target.debuggerAgent().pause(); | 109 target.debuggerAgent().pause(); |
| 110 target.runtimeAgent().runIfWaitingForDebugger(); | 110 target.runtimeAgent().runIfWaitingForDebugger(); |
| 111 }, | 111 }, |
| 112 | 112 |
| 113 /** | 113 /** |
| 114 * @param {string} workerId | 114 * @param {string} workerId |
| 115 * @param {!InspectorBackendClass.Connection.Params} params | 115 * @param {!Protocol.Connection.Params} params |
| 116 * @return {!InspectorBackendClass.Connection} | 116 * @return {!Protocol.Connection} |
| 117 */ | 117 */ |
| 118 _createConnection: function(workerId, params) | 118 _createConnection: function(workerId, params) |
| 119 { | 119 { |
| 120 var connection = new WebInspector.WorkerConnection(this, workerId, param
s); | 120 var connection = new WebInspector.WorkerConnection(this, workerId, param
s); |
| 121 this._connections.set(workerId, connection); | 121 this._connections.set(workerId, connection); |
| 122 return connection; | 122 return connection; |
| 123 }, | 123 }, |
| 124 | 124 |
| 125 /** | 125 /** |
| 126 * @param {string} workerId | 126 * @param {string} workerId |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 * @param {string} message | 203 * @param {string} message |
| 204 */ | 204 */ |
| 205 dispatchMessageFromWorker: function(workerId, message) | 205 dispatchMessageFromWorker: function(workerId, message) |
| 206 { | 206 { |
| 207 this._workerManager._dispatchMessageFromWorker(workerId, message); | 207 this._workerManager._dispatchMessageFromWorker(workerId, message); |
| 208 } | 208 } |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * @constructor | 212 * @constructor |
| 213 * @implements {InspectorBackendClass.Connection} | 213 * @implements {Protocol.Connection} |
| 214 * @param {!WebInspector.WorkerManager} workerManager | 214 * @param {!WebInspector.WorkerManager} workerManager |
| 215 * @param {string} workerId | 215 * @param {string} workerId |
| 216 * @param {!InspectorBackendClass.Connection.Params} params | 216 * @param {!Protocol.Connection.Params} params |
| 217 */ | 217 */ |
| 218 WebInspector.WorkerConnection = function(workerManager, workerId, params) | 218 WebInspector.WorkerConnection = function(workerManager, workerId, params) |
| 219 { | 219 { |
| 220 this._agent = workerManager.target().workerAgent(); | 220 this._agent = workerManager.target().workerAgent(); |
| 221 this._workerId = workerId; | 221 this._workerId = workerId; |
| 222 this._onMessage = params.onMessage; | 222 this._onMessage = params.onMessage; |
| 223 this._onDisconnect = params.onDisconnect; | 223 this._onDisconnect = params.onDisconnect; |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 WebInspector.WorkerConnection.prototype = { | 226 WebInspector.WorkerConnection.prototype = { |
| 227 /** | 227 /** |
| 228 * @override | 228 * @override |
| 229 * @param {string} message | 229 * @param {string} message |
| 230 */ | 230 */ |
| 231 sendMessage: function(message) | 231 sendMessage: function(message) |
| 232 { | 232 { |
| 233 this._agent.sendMessageToWorker(this._workerId, message); | 233 this._agent.sendMessageToWorker(this._workerId, message); |
| 234 }, | 234 }, |
| 235 | 235 |
| 236 /** | 236 /** |
| 237 * @override | 237 * @override |
| 238 * @return {!Promise} | 238 * @return {!Promise} |
| 239 */ | 239 */ |
| 240 disconnect: function() | 240 disconnect: function() |
| 241 { | 241 { |
| 242 throw new Error("Not implemented"); | 242 throw new Error("Not implemented"); |
| 243 }, | 243 }, |
| 244 }; | 244 }; |
| OLD | NEW |