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

Side by Side Diff: sdk/lib/_internal/lib/isolate_patch.dart

Issue 293393005: Make methods on isolate external. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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_patch.dart ('k') | sdk/lib/isolate/isolate.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 // Patch file for the dart:isolate library. 5 // Patch file for the dart:isolate library.
6 6
7 import 'dart:_isolate_helper' show CapabilityImpl, 7 import 'dart:_isolate_helper' show CapabilityImpl,
8 CloseToken, 8 CloseToken,
9 IsolateNatives, 9 IsolateNatives,
10 JsIsolateSink, 10 JsIsolateSink,
(...skipping 26 matching lines...) Expand all
37 throw new ArgumentError("Args must be a list of Strings $args"); 37 throw new ArgumentError("Args must be a list of Strings $args");
38 } 38 }
39 return IsolateNatives.spawnUri(uri, args, message, paused) 39 return IsolateNatives.spawnUri(uri, args, message, paused)
40 .then((msg) => new Isolate(msg[1], 40 .then((msg) => new Isolate(msg[1],
41 pauseCapability: msg[2], 41 pauseCapability: msg[2],
42 terminateCapability: msg[3])); 42 terminateCapability: msg[3]));
43 } catch (e, st) { 43 } catch (e, st) {
44 return new Future<Isolate>.error(e, st); 44 return new Future<Isolate>.error(e, st);
45 } 45 }
46 } 46 }
47
48 patch void _pause(Capability resumeCapability) {
49 var message = new List(3)
50 ..[0] = "pause"
51 ..[1] = pauseCapability
52 ..[2] = resumeCapability;
53 controlPort.send(message);
54 }
55
56 patch void resume(Capability resumeCapability) {
57 var message = new List(2)
58 ..[0] = "resume"
59 ..[1] = resumeCapability;
60 controlPort.send(message);
61 }
62
63 patch void addOnExitListener(SendPort responsePort) {
64 // TODO(lrn): Can we have an internal method that checks if the receiving
65 // isolate of a SendPort is still alive?
66 var message = new List(2)
67 ..[0] = "add-ondone"
68 ..[1] = responsePort;
69 controlPort.send(message);
70 }
71
72 patch void removeOnExitListener(SendPort responsePort) {
73 var message = new List(2)
74 ..[0] = "remove-ondone"
75 ..[1] = responsePort;
76 controlPort.send(message);
77 }
78
79 patch void setErrorsFatal(bool errorsAreFatal) {
80 var message = new List(3)
81 ..[0] = "set-errors-fatal"
82 ..[1] = terminateCapability
83 ..[2] = errorsAreFatal;
84 controlPort.send(message);
85 }
86
87 patch void kill([int priority = BEFORE_NEXT_EVENT]) {
88 controlPort.send(["kill", terminateCapability, priority]);
89 }
90
91 patch void ping(SendPort responsePort, [int pingType = IMMEDIATE]) {
92 var message = new List(3)
93 ..[0] = "ping"
94 ..[1] = responsePort
95 ..[2] = pingType;
96 controlPort.send(message);
97 }
98
99 patch void addErrorListener(SendPort port) {
100 var message = new List(2)
101 ..[0] = "getErrors"
102 ..[1] = port;
103 controlPort.send(message);
104 }
105
106 patch void removeErrorListener(SendPort port) {
107 var message = new List(2)
108 ..[0] = "stopErrors"
109 ..[1] = port;
110 controlPort.send(message);
111 }
47 } 112 }
48 113
49 /** Default factory for receive ports. */ 114 /** Default factory for receive ports. */
50 patch class ReceivePort { 115 patch class ReceivePort {
51 patch factory ReceivePort() = ReceivePortImpl; 116 patch factory ReceivePort() = ReceivePortImpl;
52 117
53 patch factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) { 118 patch factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) {
54 return new ReceivePortImpl.fromRawReceivePort(rawPort); 119 return new ReceivePortImpl.fromRawReceivePort(rawPort);
55 } 120 }
56 } 121 }
57 122
58 patch class RawReceivePort { 123 patch class RawReceivePort {
59 patch factory RawReceivePort([void handler(event)]) { 124 patch factory RawReceivePort([void handler(event)]) {
60 return new RawReceivePortImpl(handler); 125 return new RawReceivePortImpl(handler);
61 } 126 }
62 } 127 }
63 128
64 patch class Capability { 129 patch class Capability {
65 patch factory Capability() = CapabilityImpl; 130 patch factory Capability() = CapabilityImpl;
66 } 131 }
OLDNEW
« no previous file with comments | « runtime/lib/isolate_patch.dart ('k') | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698