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

Side by Side Diff: chrome/browser/resources/file_manager/js/metadata/metadata_dispatcher.js

Issue 17674003: Support both SharedWorkerContext and SharedWorkerGlobalScope to detect shared worker context (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TODO comment Created 7 years, 6 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 | « no previous file | 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 'use strict'; 5 'use strict';
6 6
7 // All of these scripts could be imported with a single call to importScripts, 7 // All of these scripts could be imported with a single call to importScripts,
8 // but then load and compile time errors would all be reported from the same 8 // but then load and compile time errors would all be reported from the same
9 // line. 9 // line.
10 importScripts('metadata_parser.js'); 10 importScripts('metadata_parser.js');
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 ]; 207 ];
208 208
209 nextStep(); 209 nextStep();
210 }; 210 };
211 211
212 // Webworker spec says that the worker global object is called self. That's 212 // Webworker spec says that the worker global object is called self. That's
213 // a terrible name since we use it all over the chrome codebase to capture 213 // a terrible name since we use it all over the chrome codebase to capture
214 // the 'this' keyword in lambdas. 214 // the 'this' keyword in lambdas.
215 var global = self; 215 var global = self;
216 216
217 if (global.constructor.name == 'SharedWorkerContext') { 217 // TODO(cdumez): Remove support for SharedWorkerContext name after Blink is
218 // rolled.
219 if (global.constructor.name == 'SharedWorkerContext' ||
220 global.constructor.name == 'SharedWorkerGlobalScope') {
218 global.addEventListener('connect', function(e) { 221 global.addEventListener('connect', function(e) {
219 var port = e.ports[0]; 222 var port = e.ports[0];
220 new MetadataDispatcher(port); 223 new MetadataDispatcher(port);
221 port.start(); 224 port.start();
222 }); 225 });
223 } else { 226 } else {
224 // Non-shared worker. 227 // Non-shared worker.
225 new MetadataDispatcher(global); 228 new MetadataDispatcher(global);
226 } 229 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698