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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 /** | 166 /** |
167 * @type {!WebInspector.WorkerManager} | 167 * @type {!WebInspector.WorkerManager} |
168 */ | 168 */ |
169 WebInspector.workerManager; | 169 WebInspector.workerManager; |
170 | 170 |
171 /** | 171 /** |
172 * @constructor | 172 * @constructor |
173 * @extends {InspectorBackendClass.Connection} | 173 * @extends {InspectorBackendClass.Connection} |
174 * @param {string} workerId | 174 * @param {string} workerId |
175 */ | 175 */ |
176 WebInspector.WorkerConnection = function(workerId, onConnectionReady) | 176 WebInspector.ExternalWorkerConnection = function(workerId, onConnectionReady) |
177 { | 177 { |
178 InspectorBackendClass.Connection.call(this); | 178 InspectorBackendClass.Connection.call(this); |
179 this._workerId = workerId; | 179 this._workerId = workerId; |
180 window.addEventListener("message", this._processMessage.bind(this), true); | 180 window.addEventListener("message", this._processMessage.bind(this), true); |
181 onConnectionReady(this); | 181 onConnectionReady(this); |
182 } | 182 } |
183 | 183 |
184 WebInspector.WorkerConnection.prototype = { | 184 WebInspector.ExternalWorkerConnection.prototype = { |
185 | 185 |
186 /** | 186 /** |
187 * @param {?Event} event | 187 * @param {?Event} event |
188 */ | 188 */ |
189 _processMessage: function(event) | 189 _processMessage: function(event) |
190 { | 190 { |
191 if (!event) | 191 if (!event) |
192 return; | 192 return; |
193 | 193 |
194 var message = event.data; | 194 var message = event.data; |
195 this.dispatch(message); | 195 this.dispatch(message); |
196 }, | 196 }, |
197 | 197 |
198 /** | 198 /** |
199 * @param {!Object} messageObject | 199 * @param {!Object} messageObject |
200 */ | 200 */ |
201 sendMessage: function(messageObject) | 201 sendMessage: function(messageObject) |
202 { | 202 { |
203 window.opener.postMessage({workerId: this._workerId, command: "sendMessa
geToBackend", message: messageObject}, "*"); | 203 window.opener.postMessage({workerId: this._workerId, command: "sendMessa
geToBackend", message: messageObject}, "*"); |
204 }, | 204 }, |
205 | 205 |
206 __proto__: InspectorBackendClass.Connection.prototype | 206 __proto__: InspectorBackendClass.Connection.prototype |
207 } | 207 } |
OLD | NEW |