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

Side by Side Diff: chrome/test/data/workers/worker_common.js

Issue 509016: Refactored code to allow associating workers with multiple renderers. (Closed)
Patch Set: Disabled overly-aggressive assertion in ResourceDispatcherHost. Created 10 years, 10 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
« no previous file with comments | « chrome/test/data/workers/worker_auth.html ('k') | chrome/worker/worker_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 if (!self.postMessage) { 1 if (!self.postMessage) {
2 // This is a shared worker - mimic dedicated worker APIs 2 // This is a shared worker - mimic dedicated worker APIs
3 onconnect = function(event) { 3 onconnect = function(event) {
4 event.ports[0].onmessage = function(e) { 4 event.ports[0].onmessage = function(e) {
5 self.onmessage(e); 5 self.onmessage(e);
6 }; 6 };
7 self.postMessage = function(msg, ports) { 7 self.postMessage = function(msg, ports) {
8 event.ports[0].postMessage(msg, ports); 8 event.ports[0].postMessage(msg, ports);
9 }; 9 };
10 }; 10 };
11 } 11 }
12 onmessage = function(evt) { 12 onmessage = function(evt) {
13 if (evt.data == "ping") 13 if (evt.data == "ping")
14 postMessage("pong"); 14 postMessage("pong");
15 else if (evt.data == "auth")
16 importScripts("/auth-basic");
15 else if (/eval.+/.test(evt.data)) { 17 else if (/eval.+/.test(evt.data)) {
16 try { 18 try {
17 postMessage(eval(evt.data.substr(5))); 19 postMessage(eval(evt.data.substr(5)));
18 } catch (ex) { 20 } catch (ex) {
19 postMessage(ex); 21 postMessage(ex);
20 } 22 }
21 } 23 }
22 } 24 }
OLDNEW
« no previous file with comments | « chrome/test/data/workers/worker_auth.html ('k') | chrome/worker/worker_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698