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

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

Issue 545483002: Per isolate package root. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed test. Created 6 years, 3 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 | « runtime/lib/isolate.cc ('k') | runtime/vm/bootstrap_natives.h » ('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 import "dart:collection" show HashMap; 5 import "dart:collection" show HashMap;
6 6
7 patch class ReceivePort { 7 patch class ReceivePort {
8 /* patch */ factory ReceivePort() = _ReceivePortImpl; 8 /* patch */ factory ReceivePort() = _ReceivePortImpl;
9 9
10 /* patch */ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) = 10 /* patch */ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) =
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 readyPort.close(); 270 readyPort.close();
271 } 271 }
272 return new Future<Isolate>.error(e, st); 272 return new Future<Isolate>.error(e, st);
273 }; 273 };
274 } 274 }
275 275
276 /* patch */ static Future<Isolate> spawnUri( 276 /* patch */ static Future<Isolate> spawnUri(
277 Uri uri, List<String> args, var message, 277 Uri uri, List<String> args, var message,
278 { bool paused: false, Uri packageRoot }) { 278 { bool paused: false, Uri packageRoot }) {
279 // `paused` isn't handled yet. 279 // `paused` isn't handled yet.
280 // `packageRoot` isn't handled yet.
281 if (packageRoot != null) throw new UnimplementedError("packageRoot");
282 RawReceivePort readyPort; 280 RawReceivePort readyPort;
283 try { 281 try {
284 // The VM will invoke [_startIsolate] and not `main`. 282 // The VM will invoke [_startIsolate] and not `main`.
285 readyPort = new RawReceivePort(); 283 readyPort = new RawReceivePort();
286 _spawnUri(readyPort.sendPort, uri.toString(), args, message); 284 var packageRootString =
285 (packageRoot == null) ? null : packageRoot.toString();
286 _spawnUri(
287 readyPort.sendPort, uri.toString(), args, message, packageRootString);
287 Completer completer = new Completer<Isolate>.sync(); 288 Completer completer = new Completer<Isolate>.sync();
288 readyPort.handler = (readyMessage) { 289 readyPort.handler = (readyMessage) {
289 readyPort.close(); 290 readyPort.close();
290 assert(readyMessage is List); 291 assert(readyMessage is List);
291 assert(readyMessage.length == 2); 292 assert(readyMessage.length == 2);
292 SendPort controlPort = readyMessage[0]; 293 SendPort controlPort = readyMessage[0];
293 List capabilities = readyMessage[1]; 294 List capabilities = readyMessage[1];
294 completer.complete(new Isolate(controlPort, 295 completer.complete(new Isolate(controlPort,
295 pauseCapability: capabilities[0], 296 pauseCapability: capabilities[0],
296 terminateCapability: capabilities[1])); 297 terminateCapability: capabilities[1]));
(...skipping 12 matching lines...) Expand all
309 // These values need to be kept in sync with the class IsolateMessageHandler 310 // These values need to be kept in sync with the class IsolateMessageHandler
310 // in vm/isolate.cc. 311 // in vm/isolate.cc.
311 static const _PAUSE = 1; 312 static const _PAUSE = 1;
312 static const _RESUME = 2; 313 static const _RESUME = 2;
313 314
314 static SendPort _spawnFunction(SendPort readyPort, Function topLevelFunction, 315 static SendPort _spawnFunction(SendPort readyPort, Function topLevelFunction,
315 var message) 316 var message)
316 native "Isolate_spawnFunction"; 317 native "Isolate_spawnFunction";
317 318
318 static SendPort _spawnUri(SendPort readyPort, String uri, 319 static SendPort _spawnUri(SendPort readyPort, String uri,
319 List<String> args, var message) 320 List<String> args, var message,
321 String packageRoot)
320 native "Isolate_spawnUri"; 322 native "Isolate_spawnUri";
321 323
322 static void _sendOOB(port, msg) native "Isolate_sendOOB"; 324 static void _sendOOB(port, msg) native "Isolate_sendOOB";
323 325
324 /* patch */ void _pause(Capability resumeCapability) { 326 /* patch */ void _pause(Capability resumeCapability) {
325 var msg = new List(4) 327 var msg = new List(4)
326 ..[0] = 0 // Make room for OOM message type. 328 ..[0] = 0 // Make room for OOM message type.
327 ..[1] = _PAUSE 329 ..[1] = _PAUSE
328 ..[2] = pauseCapability 330 ..[2] = pauseCapability
329 ..[3] = resumeCapability; 331 ..[3] = resumeCapability;
(...skipping 30 matching lines...) Expand all
360 } 362 }
361 363
362 /* patch */ void addErrorListener(SendPort port) { 364 /* patch */ void addErrorListener(SendPort port) {
363 throw new UnsupportedError("addErrorListener"); 365 throw new UnsupportedError("addErrorListener");
364 } 366 }
365 367
366 /* patch */ void removeErrorListener(SendPort port) { 368 /* patch */ void removeErrorListener(SendPort port) {
367 throw new UnsupportedError("removeErrorListener"); 369 throw new UnsupportedError("removeErrorListener");
368 } 370 }
369 } 371 }
OLDNEW
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698