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

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

Issue 881373002: Implemented more of the Isolate API (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | runtime/vm/isolate.h » ('j') | runtime/vm/isolate.cc » ('J')
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 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return completer.future; 328 return completer.future;
329 } 329 }
330 330
331 // TODO(iposva): Cleanup to have only one definition. 331 // TODO(iposva): Cleanup to have only one definition.
332 // These values need to be kept in sync with the class IsolateMessageHandler 332 // These values need to be kept in sync with the class IsolateMessageHandler
333 // in vm/isolate.cc. 333 // in vm/isolate.cc.
334 static const _PAUSE = 1; 334 static const _PAUSE = 1;
335 static const _RESUME = 2; 335 static const _RESUME = 2;
336 static const _PING = 3; 336 static const _PING = 3;
337 static const _KILL = 4; 337 static const _KILL = 4;
338 static const _ADD_EXIT = 5;
339 static const _DEL_EXIT = 6;
340 static const _ADD_ERROR = 7;
341 static const _DEL_ERROR = 8;
342 static const _ERROR_FATAL = 9;
338 343
339 344
340 static void _spawnFunction(SendPort readyPort, Function topLevelFunction, 345 static void _spawnFunction(SendPort readyPort, Function topLevelFunction,
341 var message, bool paused) 346 var message, bool paused)
342 native "Isolate_spawnFunction"; 347 native "Isolate_spawnFunction";
343 348
344 static void _spawnUri(SendPort readyPort, String uri, 349 static void _spawnUri(SendPort readyPort, String uri,
345 List<String> args, var message, 350 List<String> args, var message,
346 bool paused, String packageRoot) 351 bool paused, String packageRoot)
347 native "Isolate_spawnUri"; 352 native "Isolate_spawnUri";
(...skipping 12 matching lines...) Expand all
360 /* patch */ void resume(Capability resumeCapability) { 365 /* patch */ void resume(Capability resumeCapability) {
361 var msg = new List(4) 366 var msg = new List(4)
362 ..[0] = 0 // Make room for OOB message type. 367 ..[0] = 0 // Make room for OOB message type.
363 ..[1] = _RESUME 368 ..[1] = _RESUME
364 ..[2] = pauseCapability 369 ..[2] = pauseCapability
365 ..[3] = resumeCapability; 370 ..[3] = resumeCapability;
366 _sendOOB(controlPort, msg); 371 _sendOOB(controlPort, msg);
367 } 372 }
368 373
369 /* patch */ void addOnExitListener(SendPort responsePort) { 374 /* patch */ void addOnExitListener(SendPort responsePort) {
370 throw new UnsupportedError("addOnExitListener"); 375 var msg = new List(3)
376 ..[0] = 0 // Make room for OOB message type.
377 ..[1] = _ADD_EXIT
378 ..[2] = responsePort;
379 _sendOOB(controlPort, msg);
371 } 380 }
372 381
373 /* patch */ void removeOnExitListener(SendPort responsePort) { 382 /* patch */ void removeOnExitListener(SendPort responsePort) {
374 throw new UnsupportedError("removeOnExitListener"); 383 var msg = new List(3)
384 ..[0] = 0 // Make room for OOB message type.
385 ..[1] = _DEL_EXIT
386 ..[2] = responsePort;
387 _sendOOB(controlPort, msg);
375 } 388 }
376 389
377 /* patch */ void setErrorsFatal(bool errorsAreFatal) { 390 /* patch */ void setErrorsFatal(bool errorsAreFatal) {
378 throw new UnsupportedError("setErrorsFatal"); 391 var msg = new List(4)
392 ..[0] = 0 // Make room for OOB message type.
393 ..[1] = _ERROR_FATAL
394 ..[2] = terminateCapability
395 ..[3] = errorsAreFatal;
396 _sendOOB(controlPort, msg);
379 } 397 }
380 398
381 /* patch */ void kill([int priority = BEFORE_NEXT_EVENT]) { 399 /* patch */ void kill([int priority = BEFORE_NEXT_EVENT]) {
382 var msg = new List(4) 400 var msg = new List(4)
383 ..[0] = 0 // Make room for OOB message type. 401 ..[0] = 0 // Make room for OOB message type.
384 ..[1] = _KILL 402 ..[1] = _KILL
385 ..[2] = terminateCapability 403 ..[2] = terminateCapability
386 ..[3] = priority; 404 ..[3] = priority;
387 _sendOOB(controlPort, msg); 405 _sendOOB(controlPort, msg);
388 } 406 }
389 407
390 /* patch */ void ping(SendPort responsePort, [int pingType = IMMEDIATE]) { 408 /* patch */ void ping(SendPort responsePort, [int pingType = IMMEDIATE]) {
391 var msg = new List(4) 409 var msg = new List(4)
392 ..[0] = 0 // Make room for OOM message type. 410 ..[0] = 0 // Make room for OOM message type.
393 ..[1] = _PING 411 ..[1] = _PING
394 ..[2] = responsePort 412 ..[2] = responsePort
395 ..[3] = pingType; 413 ..[3] = pingType;
396 _sendOOB(controlPort, msg); 414 _sendOOB(controlPort, msg);
397 } 415 }
398 416
399 /* patch */ void addErrorListener(SendPort port) { 417 /* patch */ void addErrorListener(SendPort port) {
siva 2015/03/06 23:56:04 maybe call the param responsePort to be consistent
Ivan Posva 2015/03/07 04:20:39 I went by the names in the Dart API documentation.
400 throw new UnsupportedError("addErrorListener"); 418 var msg = new List(3)
419 ..[0] = 0 // Make room for OOB message type.
420 ..[1] = _ADD_ERROR
421 ..[2] = port;
422 _sendOOB(controlPort, msg);
401 } 423 }
402 424
403 /* patch */ void removeErrorListener(SendPort port) { 425 /* patch */ void removeErrorListener(SendPort port) {
siva 2015/03/06 23:56:04 Ditto comment on responsePort
404 throw new UnsupportedError("removeErrorListener"); 426 var msg = new List(3)
427 ..[0] = 0 // Make room for OOB message type.
428 ..[1] = _DEL_ERROR
429 ..[2] = port;
430 _sendOOB(controlPort, msg);
405 } 431 }
406 432
407 static Isolate _getCurrentIsolate() { 433 static Isolate _getCurrentIsolate() {
408 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate(); 434 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate();
409 return new Isolate(portAndCapabilities[0], 435 return new Isolate(portAndCapabilities[0],
410 pauseCapability: portAndCapabilities[1], 436 pauseCapability: portAndCapabilities[1],
411 terminateCapability: portAndCapabilities[2]); 437 terminateCapability: portAndCapabilities[2]);
412 } 438 }
413 439
414 static List _getPortAndCapabilitiesOfCurrentIsolate() 440 static List _getPortAndCapabilitiesOfCurrentIsolate()
415 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate"; 441 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate";
416 } 442 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | runtime/vm/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698