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

Unified Diff: runtime/vm/native_message_handler.cc

Issue 1319583003: Use the zone in ApiNativeScope for allocating objects in the ApiMessageReader instead of passing in… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address-code-review-comments Created 5 years, 4 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
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/native_message_handler.cc
diff --git a/runtime/vm/native_message_handler.cc b/runtime/vm/native_message_handler.cc
index 08bc7e97175c0ee8fbac8c621cc2e39e0478bb2a..da869e2d9c8090f1ecad4492794c2da34c762f3a 100644
--- a/runtime/vm/native_message_handler.cc
+++ b/runtime/vm/native_message_handler.cc
@@ -32,23 +32,16 @@ void NativeMessageHandler::CheckAccess() {
#endif
-static uint8_t* zone_allocator(uint8_t* ptr,
- intptr_t old_size,
- intptr_t new_size) {
- Zone* zone = ApiNativeScope::Current()->zone();
- return zone->Realloc<uint8_t>(ptr, old_size, new_size);
-}
-
-
bool NativeMessageHandler::HandleMessage(Message* message) {
if (message->IsOOB()) {
// We currently do not use OOB messages for native ports.
UNREACHABLE();
}
- // Enter a native scope for handling the message. This will create a
- // zone for allocating the objects for decoding the message.
+ // 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(), zone_allocator);
+ ApiMessageReader reader(message->data(), message->len());
Dart_CObject* object = reader.ReadMessage();
(*func())(message->dest_port(), object);
delete message;
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698