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

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

Issue 771993003: Add Isolate.current getter, returning the current isolate as an Isolate object. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test Created 6 years 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 | « runtime/vm/bootstrap_natives.h ('k') | sdk/lib/_internal/compiler/js_lib/isolate_patch.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 'shared/embedded_names.dart' show 7 import 'shared/embedded_names.dart' show
8 CURRENT_SCRIPT, 8 CURRENT_SCRIPT,
9 GLOBAL_FUNCTIONS; 9 GLOBAL_FUNCTIONS;
10 10
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 "Currently spawnUri is not supported without web workers."); 1008 "Currently spawnUri is not supported without web workers.");
1009 } 1009 }
1010 message = _serializeMessage(message); 1010 message = _serializeMessage(message);
1011 args = _serializeMessage(args); // Or just args.toList() ? 1011 args = _serializeMessage(args); // Or just args.toList() ?
1012 _globalState.topEventLoop.enqueue(new _IsolateContext(), () { 1012 _globalState.topEventLoop.enqueue(new _IsolateContext(), () {
1013 final func = _getJSFunctionFromName(functionName); 1013 final func = _getJSFunctionFromName(functionName);
1014 _startIsolate(func, args, message, isSpawnUri, startPaused, replyPort); 1014 _startIsolate(func, args, message, isSpawnUri, startPaused, replyPort);
1015 }, 'nonworker start'); 1015 }, 'nonworker start');
1016 } 1016 }
1017 1017
1018 static Isolate get currentIsolate {
1019 _IsolateContext context = JS_CURRENT_ISOLATE_CONTEXT();
1020 return new Isolate(context.controlPort.sendPort,
1021 pauseCapability: context.pauseCapability,
1022 terminateCapability: context.terminateCapability);
1023 }
1024
1018 static void _startIsolate(Function topLevel, 1025 static void _startIsolate(Function topLevel,
1019 List<String> args, message, 1026 List<String> args, message,
1020 bool isSpawnUri, 1027 bool isSpawnUri,
1021 bool startPaused, 1028 bool startPaused,
1022 SendPort replyTo) { 1029 SendPort replyTo) {
1023 _IsolateContext context = JS_CURRENT_ISOLATE_CONTEXT(); 1030 _IsolateContext context = JS_CURRENT_ISOLATE_CONTEXT();
1024 Primitives.initializeStatics(context.id); 1031 Primitives.initializeStatics(context.id);
1025 // The isolate's port does not keep the isolate open. 1032 // The isolate's port does not keep the isolate open.
1026 replyTo.send([_SPAWNED_SIGNAL, 1033 replyTo.send([_SPAWNED_SIGNAL,
1027 context.controlPort.sendPort, 1034 context.controlPort.sendPort,
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 } 1852 }
1846 1853
1847 bool operator==(Object other) { 1854 bool operator==(Object other) {
1848 if (identical(other, this)) return true; 1855 if (identical(other, this)) return true;
1849 if (other is CapabilityImpl) { 1856 if (other is CapabilityImpl) {
1850 return identical(_id, other._id); 1857 return identical(_id, other._id);
1851 } 1858 }
1852 return false; 1859 return false;
1853 } 1860 }
1854 } 1861 }
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | sdk/lib/_internal/compiler/js_lib/isolate_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698