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

Side by Side Diff: frog/lib/isolate_serialization.dart

Issue 8577003: Convert most of the javascript isolate code into Dart, inject JS code only when (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 9 years, 1 month 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 5 /**
6 * Abstract visitor for dart objects that can be passed as messages between any 6 * Abstract visitor for dart objects that can be passed as messages between any
7 * isolates. 7 * isolates.
8 */ 8 */
9 class MessageTraverser { 9 class MessageTraverser {
10 static bool isPrimitive(x) { 10 static bool isPrimitive(x) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return copy; 110 return copy;
111 } 111 }
112 112
113 SendPort visitSendPort(SendPortImpl port) { 113 SendPort visitSendPort(SendPortImpl port) {
114 return new SendPortImpl(port._workerId, 114 return new SendPortImpl(port._workerId,
115 port._isolateId, 115 port._isolateId,
116 port._receivePortId); 116 port._receivePortId);
117 } 117 }
118 118
119 SendPort visitReceivePort(ReceivePortImpl port) { 119 SendPort visitReceivePort(ReceivePortImpl port) {
120 return port._toNewSendPort(); 120 return port.toSendPort();
121 } 121 }
122 122
123 SendPort visitReceivePortSingleShot(ReceivePortSingleShotImpl port) { 123 SendPort visitReceivePortSingleShot(ReceivePortSingleShotImpl port) {
124 return port._toNewSendPort(); 124 return port.toSendPort();
125 } 125 }
126 } 126 }
127 127
128 /** Visitor that serializes a message as a JSON array. */ 128 /** Visitor that serializes a message as a JSON array. */
129 class Serializer extends MessageTraverser { 129 class Serializer extends MessageTraverser {
130 Serializer() : super(); 130 Serializer() : super();
131 131
132 visitPrimitive(x) => x; 132 visitPrimitive(x) => x;
133 133
134 visitList(List list) { 134 visitList(List list) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 SendPort _deserializeSendPort(List x) { 244 SendPort _deserializeSendPort(List x) {
245 int workerId = x[1]; 245 int workerId = x[1];
246 int isolateId = x[2]; 246 int isolateId = x[2];
247 int receivePortId = x[3]; 247 int receivePortId = x[3];
248 return new SendPortImpl(workerId, isolateId, receivePortId); 248 return new SendPortImpl(workerId, isolateId, receivePortId);
249 } 249 }
250 250
251 // TODO(floitsch): this should by Map<int, var> or Map<int, Dynamic>. 251 // TODO(floitsch): this should by Map<int, var> or Map<int, Dynamic>.
252 Map<int, Dynamic> _deserialized; 252 Map<int, Dynamic> _deserialized;
253 } 253 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698