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

Unified Diff: runtime/vm/native_message_handler.cc

Issue 9325022: Decode the Dart message into a Dart_CMessage structure before calling the native port callback (Closed) Base URL: https://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/native_message_handler.cc
diff --git a/runtime/vm/native_message_handler.cc b/runtime/vm/native_message_handler.cc
index ebc7121c84895ddd193c3ed90128fdbca84e8eb9..6b3f143346526800ccc2b5cd90d91dc124db3df8 100644
--- a/runtime/vm/native_message_handler.cc
+++ b/runtime/vm/native_message_handler.cc
@@ -6,6 +6,7 @@
#include "vm/isolate.h"
#include "vm/message.h"
+#include "vm/snapshot.h"
#include "vm/thread.h"
namespace dart {
@@ -47,12 +48,18 @@ static void RunWorker(uword parameter) {
// dispatched to special vm code. Implement.
UNIMPLEMENTED();
}
- // TODO(sgjesse): Once CMessageReader::ReadObject is committed,
- // use that here and pass the resulting data object to the
- // handler instead.
+ // Create a new zone for allocating all the structures for the
+ // decoded message.
+ Zone zone;
siva 2012/02/04 01:55:43 Instead of modifying zone to accept a version with
Søren Gjesse 2012/02/06 16:25:52 The problem with using an ApiZone here is that the
siva 2012/02/07 01:03:24 You could make BaseGrowableArray use BaseZone* as
+ int32_t length = reinterpret_cast<int32_t*>(
+ message->data())[Snapshot::kLengthIndex];
+ CMessageReader message_reader(message->data() + Snapshot::kHeaderSize,
+ length,
+ &zone);
siva 2012/02/04 01:55:43 Do you really want a version of the reader with a
Søren Gjesse 2012/02/06 16:25:52 We do need a thread local if we are not passing in
siva 2012/02/07 01:03:24 I have reviewed that change, it seems fine to abst
+ Dart_CMessage* cmessage = message_reader.ReadMessage();
(*handler->func())(message->dest_port(),
message->reply_port(),
- message->data());
+ cmessage);
delete message;
}
}

Powered by Google App Engine
This is Rietveld 408576698