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

Unified Diff: runtime/vm/isolate.cc

Issue 1499853004: Adds a special case for sending an int over a port with the native API. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index f8133efa01441bf6c2a1b3e9a705498c4d8cb102..73e7e16c5cc1676a864f2bbc0655b62b19447193 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -468,24 +468,28 @@ MessageHandler::MessageStatus IsolateMessageHandler::HandleMessage(
}
// Parse the message.
- MessageSnapshotReader reader(message->data(), message->len(), thread);
- const Object& msg_obj = Object::Handle(zone, reader.ReadObject());
- if (msg_obj.IsError()) {
- // An error occurred while reading the message.
- delete message;
- return ProcessUnhandledException(Error::Cast(msg_obj));
- }
- if (!msg_obj.IsNull() && !msg_obj.IsInstance()) {
- // TODO(turnidge): We need to decide what an isolate does with
- // malformed messages. If they (eventually) come from a remote
- // machine, then it might make sense to drop the message entirely.
- // In the case that the message originated locally, which is
- // always true for now, then this should never occur.
- UNREACHABLE();
- }
-
Instance& msg = Instance::Handle(zone);
- msg ^= msg_obj.raw(); // Can't use Instance::Cast because may be null.
+ if (message->type() == Message::kDataType) {
+ MessageSnapshotReader reader(message->data(), message->len(), thread);
+ const Object& msg_obj = Object::Handle(zone, reader.ReadObject());
+ if (msg_obj.IsError()) {
+ // An error occurred while reading the message.
+ delete message;
+ return ProcessUnhandledException(Error::Cast(msg_obj));
+ }
+ if (!msg_obj.IsNull() && !msg_obj.IsInstance()) {
+ // TODO(turnidge): We need to decide what an isolate does with
+ // malformed messages. If they (eventually) come from a remote
+ // machine, then it might make sense to drop the message entirely.
+ // In the case that the message originated locally, which is
+ // always true for now, then this should never occur.
+ UNREACHABLE();
+ }
+ msg ^= msg_obj.raw(); // Can't use Instance::Cast because may be null.
+ } else {
+ ASSERT(message->type() == Message::kIntegerType);
+ msg ^= Smi::New(message->integer());
+ }
MessageStatus status = kOK;
if (message->IsOOB()) {
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/message.h » ('j') | runtime/vm/message.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698