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

Unified Diff: runtime/lib/isolate.cc

Issue 584023004: Service isolate rework (Closed) Base URL: https://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
Index: runtime/lib/isolate.cc
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc
index ac7a9aac634b779313dbe82330ac52b67900ff90..2140cb066c9d9bdb58f22aa273e6832d44286c48 100644
--- a/runtime/lib/isolate.cc
+++ b/runtime/lib/isolate.cc
@@ -16,6 +16,7 @@
#include "vm/object_store.h"
#include "vm/port.h"
#include "vm/resolver.h"
+#include "vm/service.h"
#include "vm/snapshot.h"
#include "vm/symbols.h"
#include "vm/unicode.h"
@@ -102,12 +103,22 @@ DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 2) {
GET_NON_NULL_NATIVE_ARGUMENT(Instance, obj, arguments->NativeArgAt(1));
uint8_t* data = NULL;
- bool can_send_any_object = (isolate->origin_id() == port.origin_id());
+
+ Dart_Port destination_port_id = port.Id();
+
+ // The service isolate needs to send typed data objects.
+ bool sender_is_service = Service::IsServiceIsolate(isolate);
+ bool destination_is_service = Service::IsServicePort(destination_port_id);
siva 2015/01/22 22:39:31 I thought the service protocol is based on JSON. I
Cutch 2015/01/26 18:59:30 Done.
+
+ bool can_send_any_object = (isolate->origin_id() == port.origin_id()) ||
+ sender_is_service ||
+ destination_is_service;
+
MessageWriter writer(&data, &allocator, can_send_any_object);
writer.WriteMessage(obj);
// TODO(turnidge): Throw an exception when the return value is false?
- PortMap::PostMessage(new Message(port.Id(),
+ PortMap::PostMessage(new Message(destination_port_id,
data, writer.BytesWritten(),
Message::kNormalPriority));
return Object::null();

Powered by Google App Engine
This is Rietveld 408576698