| OLD | NEW |
| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 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( | 36 static uint8_t* zone_allocator( |
| 37 uint8_t* ptr, intptr_t old_size, intptr_t new_size) { | 37 uint8_t* ptr, intptr_t old_size, intptr_t new_size) { |
| 38 ApiZone* zone = ApiNativeScope::Current()->zone(); | 38 ApiZone& zone = ApiNativeScope::Current()->zone(); |
| 39 return reinterpret_cast<uint8_t*>( | 39 return reinterpret_cast<uint8_t*>( |
| 40 zone->Reallocate(reinterpret_cast<uword>(ptr), old_size, new_size)); | 40 zone.Reallocate(reinterpret_cast<uword>(ptr), old_size, new_size)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 | 43 |
| 44 static void RunWorker(uword parameter) { | 44 static void RunWorker(uword parameter) { |
| 45 NativeMessageHandler* handler = | 45 NativeMessageHandler* handler = |
| 46 reinterpret_cast<NativeMessageHandler*>(parameter); | 46 reinterpret_cast<NativeMessageHandler*>(parameter); |
| 47 #if defined(DEBUG) | 47 #if defined(DEBUG) |
| 48 handler->CheckAccess(); | 48 handler->CheckAccess(); |
| 49 #endif | 49 #endif |
| 50 | 50 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 78 | 78 |
| 79 void NativeMessageHandler::StartWorker() { | 79 void NativeMessageHandler::StartWorker() { |
| 80 int result = Thread::Start(RunWorker, reinterpret_cast<uword>(this)); | 80 int result = Thread::Start(RunWorker, reinterpret_cast<uword>(this)); |
| 81 if (result != 0) { | 81 if (result != 0) { |
| 82 FATAL1("Failed to start native message handler worker thread %d", result); | 82 FATAL1("Failed to start native message handler worker thread %d", result); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 | 86 |
| 87 } // namespace dart | 87 } // namespace dart |
| OLD | NEW |