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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart

Issue 11970007: Address Erik's comments on https://codereview.chromium.org/11778064 and fix minifier failures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | sdk/lib/_internal/compiler/implementation/lib/js_helper.dart » ('j') | 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 Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library _isolate_helper; 5 library _isolate_helper;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 9
10 ReceivePort lazyPort; 10 ReceivePort lazyPort;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 get id => JS("", "#.id", this); 378 get id => JS("", "#.id", this);
379 void set id(i) { JS("void", "#.id = #", this, i); } 379 void set id(i) { JS("void", "#.id = #", this, i); }
380 void set onmessage(f) { JS("void", "#.onmessage = #", this, f); } 380 void set onmessage(f) { JS("void", "#.onmessage = #", this, f); }
381 void postMessage(msg) { JS("void", "#.postMessage(#)", this, msg); } 381 void postMessage(msg) { JS("void", "#.postMessage(#)", this, msg); }
382 void terminate() { JS("void", "#.terminate()", this); } 382 void terminate() { JS("void", "#.terminate()", this); }
383 } 383 }
384 384
385 const String _SPAWNED_SIGNAL = "spawned"; 385 const String _SPAWNED_SIGNAL = "spawned";
386 386
387 var globalThis = IsolateNatives.computeGlobalThis(); 387 var globalThis = IsolateNatives.computeGlobalThis();
388 var globalWindow = JS('', "#['window']", globalThis); 388 var globalWindow = JS('', "#.window", globalThis);
389 var globalWorker = JS('', "#['Worker']", globalThis); 389 var globalWorker = JS('', "#.Worker", globalThis);
390 bool globalPostMessageDefined = 390 bool globalPostMessageDefined =
391 JS('', "#['postMessage'] !== (void 0)", globalThis); 391 JS('', "#.postMessage !== (void 0)", globalThis);
392 392
393 class IsolateNatives { 393 class IsolateNatives {
394 394
395 static String thisScript = computeThisScript(); 395 static String thisScript = computeThisScript();
396 396
397 /** 397 /**
398 * The src url for the script tag that loaded this code. Used to create 398 * The src url for the script tag that loaded this code. Used to create
399 * JavaScript workers. 399 * JavaScript workers.
400 */ 400 */
401 static String computeThisScript() { 401 static String computeThisScript() {
402 // TODO(7369): Find a cross-platform non-brittle way of getting the 402 // TODO(7369): Find a cross-platform non-brittle way of getting the
403 // currently running script. 403 // currently running script.
404 var scripts = JS('=List', r"document.getElementsByTagName('script')"); 404 var scripts = JS('=List', r"document.getElementsByTagName('script')");
405 // The scripts variable only contains the scripts that have already been 405 // The scripts variable only contains the scripts that have already been
406 // executed. The last one is the currently running script. 406 // executed. The last one is the currently running script.
407 for (var script in scripts) { 407 for (var script in scripts) {
408 var src = JS('String|Null', '# && #.src', script, script); 408 var src = JS('String|Null', '# && #.src', script, script);
409 // Filter out the test controller script, and the Dart
410 // bootstrap script.
409 if (src != null 411 if (src != null
410 && !src.endsWith('test_controller.js') 412 && !src.endsWith('test_controller.js')
411 && !new RegExp('client.dart\.js').hasMatch(src)) { 413 && !src.endsWith('dart.js')) {
ngeoffray 2013/01/16 10:33:38 The path has now changed. To make things simple, I
412 return src; 414 return src;
413 } 415 }
414 } 416 }
415 return null; 417 return null;
416 } 418 }
417 419
418 static computeGlobalThis() => JS('', 'function() { return this; }()'); 420 static computeGlobalThis() => JS('', 'function() { return this; }()');
419 421
420 /** Starts a new worker with the given URL. */ 422 /** Starts a new worker with the given URL. */
421 static _WorkerStub _newWorker(url) => JS("_WorkerStub", r"new Worker(#)", url) ; 423 static _WorkerStub _newWorker(url) => JS("_WorkerStub", r"new Worker(#)", url) ;
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 JS('void', '#.clearInterval(#)', globalThis, _handle); 1328 JS('void', '#.clearInterval(#)', globalThis, _handle);
1327 } 1329 }
1328 _handle = null; 1330 _handle = null;
1329 } else { 1331 } else {
1330 throw new UnsupportedError("Canceling a timer."); 1332 throw new UnsupportedError("Canceling a timer.");
1331 } 1333 }
1332 } 1334 }
1333 } 1335 }
1334 1336
1335 bool hasTimer() => JS('', '#.setTimeout', globalThis) != null; 1337 bool hasTimer() => JS('', '#.setTimeout', globalThis) != null;
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698