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

Side by Side Diff: runtime/vm/native_message_handler.cc

Issue 11028145: Changed StackZone and ApiZone to be containers for Zone. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor tweak to use RawError instead of RawObject. Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/handles.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/native_message_handler.h" 5 #include "vm/native_message_handler.h"
6 6
7 #include "vm/dart_api_message.h" 7 #include "vm/dart_api_message.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/message.h" 9 #include "vm/message.h"
10 #include "vm/snapshot.h" 10 #include "vm/snapshot.h"
(...skipping 18 matching lines...) Expand all
29 #if defined(DEBUG) 29 #if defined(DEBUG)
30 void NativeMessageHandler::CheckAccess() { 30 void NativeMessageHandler::CheckAccess() {
31 ASSERT(Isolate::Current() == NULL); 31 ASSERT(Isolate::Current() == NULL);
32 } 32 }
33 #endif 33 #endif
34 34
35 35
36 static uint8_t* zone_allocator(uint8_t* ptr, 36 static uint8_t* zone_allocator(uint8_t* ptr,
37 intptr_t old_size, 37 intptr_t old_size,
38 intptr_t new_size) { 38 intptr_t new_size) {
39 ApiZone* zone = ApiNativeScope::Current()->zone(); 39 Zone* zone = ApiNativeScope::Current()->zone();
40 return zone->Realloc<uint8_t>(ptr, old_size, new_size); 40 return zone->Realloc<uint8_t>(ptr, old_size, new_size);
41 } 41 }
42 42
43 43
44 bool NativeMessageHandler::HandleMessage(Message* message) { 44 bool NativeMessageHandler::HandleMessage(Message* message) {
45 if (message->IsOOB()) { 45 if (message->IsOOB()) {
46 // We currently do not use OOB messages for native ports. 46 // We currently do not use OOB messages for native ports.
47 UNREACHABLE(); 47 UNREACHABLE();
48 } 48 }
49 // Enter a native scope for handling the message. This will create a 49 // Enter a native scope for handling the message. This will create a
50 // zone for allocating the objects for decoding the message. 50 // zone for allocating the objects for decoding the message.
51 ApiNativeScope scope; 51 ApiNativeScope scope;
52 ApiMessageReader reader(message->data(), message->len(), zone_allocator); 52 ApiMessageReader reader(message->data(), message->len(), zone_allocator);
53 Dart_CObject* object = reader.ReadMessage(); 53 Dart_CObject* object = reader.ReadMessage();
54 (*func())(message->dest_port(), message->reply_port(), object); 54 (*func())(message->dest_port(), message->reply_port(), object);
55 delete message; 55 delete message;
56 return true; 56 return true;
57 } 57 }
58 58
59 } // namespace dart 59 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/handles.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698