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

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

Issue 10828410: Unify dart:isolate. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
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 class _ReceivePortFactory { 5 patch class _ReceivePortFactory {
6 factory ReceivePort() { 6 /* patch */ factory ReceivePort() {
7 return new _ReceivePortImpl(); 7 return new _ReceivePortImpl();
8 } 8 }
9 } 9 }
10 10
11
12 class _ReceivePortImpl implements ReceivePort { 11 class _ReceivePortImpl implements ReceivePort {
13 /*--- public interface ---*/
14 factory _ReceivePortImpl() native "ReceivePortImpl_factory"; 12 factory _ReceivePortImpl() native "ReceivePortImpl_factory";
15 13
16 receive(void onMessage(var message, SendPort replyTo)) { 14 receive(void onMessage(var message, SendPort replyTo)) {
17 _onMessage = onMessage; 15 _onMessage = onMessage;
18 } 16 }
19 17
20 close() { 18 close() {
21 _portMap.remove(_id); 19 _portMap.remove(_id);
22 _closeInternal(_id); 20 _closeInternal(_id);
23 } 21 }
24 22
25 SendPort toSendPort() { 23 sendPort toSendPort() {
Mads Ager (google) 2012/08/21 07:27:57 Undo this change?
Anders Johnsen 2012/08/21 07:45:05 Done.
26 return new _SendPortImpl(_id); 24 return new _SendPortImpl(_id);
27 } 25 }
28 26
29 /**** Internal implementation details ****/ 27 /**** Internal implementation details ****/
30 // Called from the VM to create a new ReceivePort instance. 28 // Called from the VM to create a new ReceivePort instance.
31 static _ReceivePortImpl _get_or_create(int id) { 29 static _ReceivePortImpl _get_or_create(int id) {
32 if (_portMap !== null) { 30 if (_portMap !== null) {
33 _ReceivePortImpl port = _portMap[id]; 31 _ReceivePortImpl port = _portMap[id];
34 if (port !== null) { 32 if (port !== null) {
35 return port; 33 return port;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 static _sendInternal(int sendId, int replyId, var message) 109 static _sendInternal(int sendId, int replyId, var message)
112 native "SendPortImpl_sendInternal_"; 110 native "SendPortImpl_sendInternal_";
113 111
114 final int _id; 112 final int _id;
115 } 113 }
116 114
117 _getPortInternal() native "isolate_getPortInternal"; 115 _getPortInternal() native "isolate_getPortInternal";
118 116
119 ReceivePort _portInternal; 117 ReceivePort _portInternal;
120 118
121 ReceivePort get _port() { 119 patch ReceivePort get port() {
122 if (_portInternal === null) { 120 if (_portInternal === null) {
123 _portInternal = _getPortInternal(); 121 _portInternal = _getPortInternal();
124 } 122 }
125 return _portInternal; 123 return _portInternal;
126 } 124 }
127 125
128 _spawnFunction(void topLevelFunction()) native "isolate_spawnFunction"; 126 patch spawnFunction(void topLevelFunction()) native "isolate_spawnFunction";
129 127
130 _spawnUri(String uri) native "isolate_spawnUri"; 128 patch spawnUri(String uri) native "isolate_spawnUri";
129
130 /***************
Mads Ager (google) 2012/08/21 07:27:57 I would remove this from this file and add the TOD
Anders Johnsen 2012/08/21 07:45:05 Done.
131 Timer
132 ***************/
133
134 // TODO(ajohnsen): Patch timer once we have support for patching named
135 // factory constructors.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698