Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: Source/devtools/front_end/sdk/WorkerManager.js

Issue 392603002: DevTools: refactoring connection creation, removing a couple of dead code branches. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/sdk/InspectorBackend.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
166 166
167 /** 167 /**
168 * @type {!WebInspector.WorkerManager} 168 * @type {!WebInspector.WorkerManager}
169 */ 169 */
170 WebInspector.workerManager; 170 WebInspector.workerManager;
171 171
172 /** 172 /**
173 * @constructor 173 * @constructor
174 * @extends {InspectorBackendClass.Connection} 174 * @extends {InspectorBackendClass.Connection}
175 * @param {string} workerId 175 * @param {string} workerId
176 * @param {function(!InspectorBackendClass.Connection)} onConnectionReady
177 */ 176 */
178 WebInspector.ExternalWorkerConnection = function(workerId, onConnectionReady) 177 WebInspector.ExternalWorkerConnection = function(workerId)
179 { 178 {
180 InspectorBackendClass.Connection.call(this); 179 InspectorBackendClass.Connection.call(this);
181 this._workerId = workerId; 180 this._workerId = workerId;
182 window.addEventListener("message", this._processMessage.bind(this), true); 181 window.addEventListener("message", this._processMessage.bind(this), true);
183 onConnectionReady(this);
184 } 182 }
185 183
186 WebInspector.ExternalWorkerConnection.prototype = { 184 WebInspector.ExternalWorkerConnection.prototype = {
187 185
188 /** 186 /**
189 * @param {?Event} event 187 * @param {?Event} event
190 */ 188 */
191 _processMessage: function(event) 189 _processMessage: function(event)
192 { 190 {
193 if (!event) 191 if (!event)
194 return; 192 return;
195 193
196 var message = event.data; 194 var message = event.data;
197 this.dispatch(message); 195 this.dispatch(message);
198 }, 196 },
199 197
200 /** 198 /**
201 * @param {!Object} messageObject 199 * @param {!Object} messageObject
202 */ 200 */
203 sendMessage: function(messageObject) 201 sendMessage: function(messageObject)
204 { 202 {
205 window.opener.postMessage({workerId: this._workerId, command: "sendMessa geToBackend", message: messageObject}, "*"); 203 window.opener.postMessage({workerId: this._workerId, command: "sendMessa geToBackend", message: messageObject}, "*");
206 }, 204 },
207 205
208 __proto__: InspectorBackendClass.Connection.prototype 206 __proto__: InspectorBackendClass.Connection.prototype
209 } 207 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/InspectorBackend.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698