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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart

Issue 2698353003: unfork DDC's copy of most SDK libraries (Closed)
Patch Set: revert core_patch Created 3 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
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 dart._isolate_helper; 5 library dart._isolate_helper;
6 6
7 import 'dart:_js_embedded_names' show 7 import 'dart:_js_embedded_names' show
8 CLASS_ID_EXTRACTOR, 8 CLASS_ID_EXTRACTOR,
9 CLASS_FIELDS_EXTRACTOR, 9 CLASS_FIELDS_EXTRACTOR,
10 CURRENT_SCRIPT, 10 CURRENT_SCRIPT,
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 375 }
376 376
377 void handlePing(SendPort responsePort, int pingType) { 377 void handlePing(SendPort responsePort, int pingType) {
378 if (pingType == Isolate.IMMEDIATE || 378 if (pingType == Isolate.IMMEDIATE ||
379 (pingType == Isolate.BEFORE_NEXT_EVENT && 379 (pingType == Isolate.BEFORE_NEXT_EVENT &&
380 !_isExecutingEvent)) { 380 !_isExecutingEvent)) {
381 responsePort.send(null); 381 responsePort.send(null);
382 return; 382 return;
383 } 383 }
384 void respond() { responsePort.send(null); } 384 void respond() { responsePort.send(null); }
385 if (pingType == Isolate.AS_EVENT) {
386 _globalState.topEventLoop.enqueue(this, respond, "ping");
387 return;
388 }
389 assert(pingType == Isolate.BEFORE_NEXT_EVENT); 385 assert(pingType == Isolate.BEFORE_NEXT_EVENT);
390 if (_scheduledControlEvents == null) { 386 if (_scheduledControlEvents == null) {
391 _scheduledControlEvents = new Queue(); 387 _scheduledControlEvents = new Queue();
392 } 388 }
393 _scheduledControlEvents.addLast(respond); 389 _scheduledControlEvents.addLast(respond);
394 } 390 }
395 391
396 void handleKill(Capability authentification, int priority) { 392 void handleKill(Capability authentification, int priority) {
397 if (this.terminateCapability != authentification) return; 393 if (this.terminateCapability != authentification) return;
398 if (priority == Isolate.IMMEDIATE || 394 if (priority == Isolate.IMMEDIATE ||
399 (priority == Isolate.BEFORE_NEXT_EVENT && 395 (priority == Isolate.BEFORE_NEXT_EVENT &&
400 !_isExecutingEvent)) { 396 !_isExecutingEvent)) {
401 kill(); 397 kill();
402 return; 398 return;
403 } 399 }
404 if (priority == Isolate.AS_EVENT) {
405 _globalState.topEventLoop.enqueue(this, kill, "kill");
406 return;
407 }
408 assert(priority == Isolate.BEFORE_NEXT_EVENT); 400 assert(priority == Isolate.BEFORE_NEXT_EVENT);
409 if (_scheduledControlEvents == null) { 401 if (_scheduledControlEvents == null) {
410 _scheduledControlEvents = new Queue(); 402 _scheduledControlEvents = new Queue();
411 } 403 }
412 _scheduledControlEvents.addLast(kill); 404 _scheduledControlEvents.addLast(kill);
413 } 405 }
414 406
415 void addErrorListener(SendPort port) { 407 void addErrorListener(SendPort port) {
416 errorPorts.add(port); 408 errorPorts.add(port);
417 } 409 }
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 // primitives that require support for spawning workers. The field starts out 729 // primitives that require support for spawning workers. The field starts out
738 // by being null, and dart2js' type inference will track if it can have a 730 // by being null, and dart2js' type inference will track if it can have a
739 // non-null value. So by testing if this value is not null, we generate code 731 // non-null value. So by testing if this value is not null, we generate code
740 // that dart2js knows is dead when worker support isn't needed. 732 // that dart2js knows is dead when worker support isn't needed.
741 // TODO(herhut): Initialize this to false when able to track compile-time 733 // TODO(herhut): Initialize this to false when able to track compile-time
742 // constants. 734 // constants.
743 static var enableSpawnWorker; 735 static var enableSpawnWorker;
744 736
745 static String thisScript = computeThisScript(); 737 static String thisScript = computeThisScript();
746 738
739 /// Returns the base path added to Uri.base to resolve `package:` Uris.
740 ///
741 /// This is used by `Isolate.resolvePackageUri` to load resources. The default
742 /// value is `packages/` but users can override this by using the
743 /// `defaultPackagesBase` hook.
744 static String get packagesBase =>
745 JS('String', r'self.defaultPackagesBase || "packages/"');
746
747 /// Associates an ID with a native worker object. 747 /// Associates an ID with a native worker object.
748 static final Expando<int> workerIds = new Expando<int>(); 748 static final Expando<int> workerIds = new Expando<int>();
749 749
750 /** 750 /**
751 * The src url for the script tag that loaded this Used to create 751 * The src url for the script tag that loaded this Used to create
752 * JavaScript workers. 752 * JavaScript workers.
753 */ 753 */
754 static String computeThisScript() { 754 static String computeThisScript() {
755 // See: https://github.com/dart-lang/dev_compiler/issues/164 755 // See: https://github.com/dart-lang/dev_compiler/issues/164
756 // var currentScript = JS_EMBEDDED_GLOBAL('', CURRENT_SCRIPT); 756 // var currentScript = JS_EMBEDDED_GLOBAL('', CURRENT_SCRIPT);
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 } 1446 }
1447 1447
1448 bool operator==(Object other) { 1448 bool operator==(Object other) {
1449 if (identical(other, this)) return true; 1449 if (identical(other, this)) return true;
1450 if (other is CapabilityImpl) { 1450 if (other is CapabilityImpl) {
1451 return identical(_id, other._id); 1451 return identical(_id, other._id);
1452 } 1452 }
1453 return false; 1453 return false;
1454 } 1454 }
1455 } 1455 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698