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

Unified Diff: runtime/bin/io_service_patch.dart

Issue 834233003: Fix for issue 21398 (only send "literal like" objects across isolates spawned using spawnURI (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/include/dart_native_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/io_service_patch.dart
===================================================================
--- runtime/bin/io_service_patch.dart (revision 42788)
+++ runtime/bin/io_service_patch.dart (working copy)
@@ -20,7 +20,14 @@
_initialize(index);
var completer = new Completer();
_messageMap[id] = completer;
- _servicePort[index].send([id, _replyToPort, request, data]);
+ try {
+ _servicePort[index].send([id, _replyToPort, request, data]);
+ } catch (error) {
+ _messageMap.remove(id).complete(error);
+ if (_messageMap.length == 0) {
+ _finalize();
+ }
+ }
return completer.future;
}
@@ -35,14 +42,18 @@
assert(data is List && data.length == 2);
_messageMap.remove(data[0]).complete(data[1]);
if (_messageMap.length == 0) {
- _id = 0;
- _receivePort.close();
- _receivePort = null;
+ _finalize();
}
};
}
}
+ static void _finalize() {
+ _id = 0;
+ _receivePort.close();
+ _receivePort = null;
+ }
+
static int _getNextId() {
if (_id == 0x7FFFFFFF) _id = 0;
return _id++;
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/include/dart_native_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698