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

Unified Diff: runtime/vm/port.cc

Issue 9182001: OOB messages and general message refactor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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
Index: runtime/vm/port.cc
===================================================================
--- runtime/vm/port.cc (revision 3210)
+++ runtime/vm/port.cc (working copy)
@@ -6,6 +6,7 @@
#include "vm/dart_api_impl.h"
#include "vm/isolate.h"
+#include "vm/message_queue.h"
#include "vm/thread.h"
#include "vm/utils.h"
@@ -164,12 +165,7 @@
deleted_++;
MaintainInvariants();
}
-
- // Notify the embedder that this port is closed.
- Dart_ClosePortCallback callback = isolate->close_port_callback();
- ASSERT(callback);
- ASSERT(port != kCloseAllPorts);
- (*callback)(Api::CastIsolate(isolate), port);
+ isolate->ClosePort(port);
}
@@ -190,19 +186,13 @@
}
MaintainInvariants();
}
-
- // Notify the embedder that all ports are closed.
- Dart_ClosePortCallback callback = isolate->close_port_callback();
- ASSERT(callback);
- (*callback)(Api::CastIsolate(isolate), kCloseAllPorts);
+ isolate->CloseAllPorts();
}
-bool PortMap::PostMessage(Dart_Port dest_port,
- Dart_Port reply_port,
- Dart_Message message) {
+bool PortMap::PostMessage(Message* message) {
mutex_->Lock();
- intptr_t index = FindPort(dest_port);
+ intptr_t index = FindPort(message->dest_port());
if (index < 0) {
free(message);
mutex_->Unlock();
@@ -213,15 +203,9 @@
Isolate* isolate = map_[index].isolate;
ASSERT(map_[index].port != 0);
ASSERT((isolate != NULL) && (isolate != deleted_entry_));
-
- // Delegate message delivery to the embedder.
- Dart_PostMessageCallback callback = isolate->post_message_callback();
- ASSERT(callback);
- bool result =
- (*callback)(Api::CastIsolate(isolate), dest_port, reply_port, message);
-
+ isolate->PostMessage(message);
mutex_->Unlock();
- return result;
+ return true;
}

Powered by Google App Engine
This is Rietveld 408576698