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

Unified Diff: runtime/lib/isolate_patch.dart

Issue 11440035: Optimize the message queue for many active ports with few messages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Lookup ReceivePort in Dart code Created 8 years 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 | « no previous file | runtime/vm/dart_entry.h » ('j') | runtime/vm/isolate.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/isolate_patch.dart
diff --git a/runtime/lib/isolate_patch.dart b/runtime/lib/isolate_patch.dart
index ad3864f1354f37d0346d232491c62732832f3478..72395e81a73185220d61e87aa2da9192e61f416d 100644
--- a/runtime/lib/isolate_patch.dart
+++ b/runtime/lib/isolate_patch.dart
@@ -35,6 +35,7 @@ class _ReceivePortImpl implements ReceivePort {
}
return new _ReceivePortImpl._internal(id);
}
+
_ReceivePortImpl._internal(int id) : _id = id {
if (_portMap == null) {
_portMap = new Map();
@@ -42,10 +43,15 @@ class _ReceivePortImpl implements ReceivePort {
_portMap[id] = this;
}
- // Called from the VM to dispatch to the handler.
- static void _handleMessage(int id, int replyId, var message) {
+ // Called from the VM to retrieve the ReceivePort for a message.
+ static _ReceivePortImpl _lookupReceivePort(int id) {
assert(_portMap != null);
- ReceivePort port = _portMap[id];
+ return _portMap[id];
+ }
+
+ // Called from the VM to dispatch to the handler.
+ static void _handleMessage(_ReceivePortImpl port, int replyId, var message) {
+ assert(port != null);
SendPort replyTo = (replyId == 0) ? null : new _SendPortImpl(replyId);
(port._onMessage)(message, replyTo);
}
« no previous file with comments | « no previous file | runtime/vm/dart_entry.h » ('j') | runtime/vm/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698