OLD | NEW |
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:_js_helper' show patch; | 7 import 'dart:_js_helper' show patch; |
8 import 'dart:_isolate_helper' show CapabilityImpl, | 8 import 'dart:_isolate_helper' show CapabilityImpl, |
9 CloseToken, | 9 CloseToken, |
10 IsolateNatives, | 10 IsolateNatives, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 @patch | 70 @patch |
71 void resume(Capability resumeCapability) { | 71 void resume(Capability resumeCapability) { |
72 var message = new List(2) | 72 var message = new List(2) |
73 ..[0] = "resume" | 73 ..[0] = "resume" |
74 ..[1] = resumeCapability; | 74 ..[1] = resumeCapability; |
75 controlPort.send(message); | 75 controlPort.send(message); |
76 } | 76 } |
77 | 77 |
78 @patch | 78 @patch |
79 void addOnExitListener(SendPort responsePort) { | 79 void addOnExitListener(SendPort responsePort, {Object response}) { |
80 // TODO(lrn): Can we have an internal method that checks if the receiving | 80 // TODO(lrn): Can we have an internal method that checks if the receiving |
81 // isolate of a SendPort is still alive? | 81 // isolate of a SendPort is still alive? |
82 var message = new List(2) | 82 var message = new List(3) |
83 ..[0] = "add-ondone" | 83 ..[0] = "add-ondone" |
84 ..[1] = responsePort; | 84 ..[1] = responsePort |
| 85 ..[2] = response; |
85 controlPort.send(message); | 86 controlPort.send(message); |
86 } | 87 } |
87 | 88 |
88 @patch | 89 @patch |
89 void removeOnExitListener(SendPort responsePort) { | 90 void removeOnExitListener(SendPort responsePort) { |
90 var message = new List(2) | 91 var message = new List(2) |
91 ..[0] = "remove-ondone" | 92 ..[0] = "remove-ondone" |
92 ..[1] = responsePort; | 93 ..[1] = responsePort; |
93 controlPort.send(message); | 94 controlPort.send(message); |
94 } | 95 } |
95 | 96 |
96 @patch | 97 @patch |
97 void setErrorsFatal(bool errorsAreFatal) { | 98 void setErrorsFatal(bool errorsAreFatal) { |
98 var message = new List(3) | 99 var message = new List(3) |
99 ..[0] = "set-errors-fatal" | 100 ..[0] = "set-errors-fatal" |
100 ..[1] = terminateCapability | 101 ..[1] = terminateCapability |
101 ..[2] = errorsAreFatal; | 102 ..[2] = errorsAreFatal; |
102 controlPort.send(message); | 103 controlPort.send(message); |
103 } | 104 } |
104 | 105 |
105 @patch | 106 @patch |
106 void kill([int priority = BEFORE_NEXT_EVENT]) { | 107 void kill({int priority: BEFORE_NEXT_EVENT}) { |
107 controlPort.send(["kill", terminateCapability, priority]); | 108 controlPort.send(["kill", terminateCapability, priority]); |
108 } | 109 } |
109 | 110 |
110 @patch | 111 @patch |
111 void ping(SendPort responsePort, [int pingType = IMMEDIATE]) { | 112 void ping(SendPort responsePort, {Object response, |
112 var message = new List(3) | 113 int priority: IMMEDIATE}) { |
| 114 var message = new List(4) |
113 ..[0] = "ping" | 115 ..[0] = "ping" |
114 ..[1] = responsePort | 116 ..[1] = responsePort |
115 ..[2] = pingType; | 117 ..[2] = priority |
| 118 ..[3] = response; |
116 controlPort.send(message); | 119 controlPort.send(message); |
117 } | 120 } |
118 | 121 |
119 @patch | 122 @patch |
120 void addErrorListener(SendPort port) { | 123 void addErrorListener(SendPort port) { |
121 var message = new List(2) | 124 var message = new List(2) |
122 ..[0] = "getErrors" | 125 ..[0] = "getErrors" |
123 ..[1] = port; | 126 ..[1] = port; |
124 controlPort.send(message); | 127 controlPort.send(message); |
125 } | 128 } |
(...skipping 25 matching lines...) Expand all Loading... |
151 factory RawReceivePort([void handler(event)]) { | 154 factory RawReceivePort([void handler(event)]) { |
152 return new RawReceivePortImpl(handler); | 155 return new RawReceivePortImpl(handler); |
153 } | 156 } |
154 } | 157 } |
155 | 158 |
156 @patch | 159 @patch |
157 class Capability { | 160 class Capability { |
158 @patch | 161 @patch |
159 factory Capability() = CapabilityImpl; | 162 factory Capability() = CapabilityImpl; |
160 } | 163 } |
OLD | NEW |