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

Unified Diff: runtime/vm/dart_api_impl.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/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index f607b189a0cd005500ddd7ce5959c4976a70e346..868a920c9f11428d8546d210d706530dccf6060e 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1587,7 +1587,15 @@ DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) {
if (port_id == ILLEGAL_PORT) {
return false;
}
- const Object& object = Object::Handle(Z, Api::UnwrapHandle(handle));
+
+ // Smis and null can be sent without serialization.
+ RawObject* raw_obj = Api::UnwrapHandle(handle);
Ivan Posva 2015/12/11 21:02:38 Please make sure that this code is wrapped in a No
zra 2015/12/11 22:01:30 Done.
+ if (ApiObjectConverter::CanConvert(raw_obj)) {
+ return PortMap::PostMessage(new Message(
+ port_id, raw_obj, Message::kNormalPriority));
+ }
+
+ const Object& object = Object::Handle(Z, raw_obj);
uint8_t* data = NULL;
MessageWriter writer(&data, &allocator, false);
writer.WriteMessage(object);

Powered by Google App Engine
This is Rietveld 408576698