Index: runtime/vm/native_message_handler.cc |
diff --git a/runtime/vm/native_message_handler.cc b/runtime/vm/native_message_handler.cc |
index 8f8d7a6971c725426060d8f1a5aa9aa6d4666a95..5992016e2aa7ee99d6a6701b306d0c4e44dc7239 100644 |
--- a/runtime/vm/native_message_handler.cc |
+++ b/runtime/vm/native_message_handler.cc |
@@ -38,13 +38,21 @@ MessageHandler::MessageStatus NativeMessageHandler::HandleMessage( |
// We currently do not use OOB messages for native ports. |
UNREACHABLE(); |
} |
- // We create a native scope for handling the message. |
- // All allocation of objects for decoding the message is done in the |
- // zone associated with this scope. |
- ApiNativeScope scope; |
- ApiMessageReader reader(message->data(), message->len()); |
- Dart_CObject* object = reader.ReadMessage(); |
- (*func())(message->dest_port(), object); |
+ if (message->type() == Message::kDataType) { |
+ // We create a native scope for handling the message. |
+ // All allocation of objects for decoding the message is done in the |
+ // zone associated with this scope. |
+ ApiNativeScope scope; |
+ ApiMessageReader reader(message->data(), message->len()); |
+ Dart_CObject* object = reader.ReadMessage(); |
+ (*func())(message->dest_port(), object); |
+ } else { |
+ ASSERT(message->type() == Message::kIntegerType); |
+ Dart_CObject integer; |
+ integer.type = Dart_CObject_kInt64; |
+ integer.value.as_int64 = message->integer(); |
+ (*func())(message->dest_port(), &integer); |
+ } |
delete message; |
return kOK; |
} |