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

Side by Side Diff: runtime/lib/isolate_patch.dart

Issue 1334353002: - Add getters for the current packageRoot or packageMap. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Moved accessors for packageRoot/packageMap to class Isolate. Created 5 years, 2 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 import "dart:collection" show HashMap; 5 import "dart:collection" show HashMap;
6 import "dart:_internal"; 6 import "dart:_internal";
7 7
8 patch class ReceivePort { 8 patch class ReceivePort {
9 /* patch */ factory ReceivePort() = _ReceivePortImpl; 9 /* patch */ factory ReceivePort() = _ReceivePortImpl;
10 10
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 }; 268 };
269 // Make sure the message handler is triggered. 269 // Make sure the message handler is triggered.
270 port.sendPort.send(null); 270 port.sendPort.send(null);
271 } 271 }
272 272
273 patch class Isolate { 273 patch class Isolate {
274 static final _currentIsolate = _getCurrentIsolate(); 274 static final _currentIsolate = _getCurrentIsolate();
275 275
276 /* patch */ static Isolate get current => _currentIsolate; 276 /* patch */ static Isolate get current => _currentIsolate;
277 277
278 /* patch */ static Future<Uri> get packageRoot {
279 var hook = VMLibraryHooks.getPackageRoot;
280 if (hook == null) {
281 throw new UnimplementedError("Isolate.packageRoot");
282 }
283 return hook();
284 }
285
286 /* patch */ static Future<Map<String, Uri>> get packageMap {
287 var hook = VMLibraryHooks.getPackageMap;
288 if (hook == null) {
289 throw new UnimplementedError("Isolate.packageMap");
290 }
291 return hook();
292 }
293
278 /* patch */ static Future<Isolate> spawn( 294 /* patch */ static Future<Isolate> spawn(
279 void entryPoint(message), var message, 295 void entryPoint(message), var message,
280 {bool paused: false, bool errorsAreFatal, 296 {bool paused: false, bool errorsAreFatal,
281 SendPort onExit, SendPort onError}) { 297 SendPort onExit, SendPort onError}) {
282 // `paused` isn't handled yet. 298 // `paused` isn't handled yet.
283 RawReceivePort readyPort; 299 RawReceivePort readyPort;
284 try { 300 try {
285 // The VM will invoke [_startIsolate] with entryPoint as argument. 301 // The VM will invoke [_startIsolate] with entryPoint as argument.
286 readyPort = new RawReceivePort(); 302 readyPort = new RawReceivePort();
287 _spawnFunction(readyPort.sendPort, entryPoint, message, 303 _spawnFunction(readyPort.sendPort, entryPoint, message,
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 static Isolate _getCurrentIsolate() { 475 static Isolate _getCurrentIsolate() {
460 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate(); 476 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate();
461 return new Isolate(portAndCapabilities[0], 477 return new Isolate(portAndCapabilities[0],
462 pauseCapability: portAndCapabilities[1], 478 pauseCapability: portAndCapabilities[1],
463 terminateCapability: portAndCapabilities[2]); 479 terminateCapability: portAndCapabilities[2]);
464 } 480 }
465 481
466 static List _getPortAndCapabilitiesOfCurrentIsolate() 482 static List _getPortAndCapabilitiesOfCurrentIsolate()
467 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate"; 483 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate";
468 } 484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698