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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 | 6 |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
11 #include "vm/dart_api_impl.h" | 11 #include "vm/dart_api_impl.h" |
| 12 #include "vm/dart_api_message.h" |
12 #include "vm/dart_api_state.h" | 13 #include "vm/dart_api_state.h" |
13 #include "vm/dart_entry.h" | 14 #include "vm/dart_entry.h" |
14 #include "vm/debuginfo.h" | 15 #include "vm/debuginfo.h" |
15 #include "vm/exceptions.h" | 16 #include "vm/exceptions.h" |
16 #include "vm/growable_array.h" | 17 #include "vm/growable_array.h" |
17 #include "vm/message.h" | 18 #include "vm/message.h" |
18 #include "vm/native_entry.h" | 19 #include "vm/native_entry.h" |
19 #include "vm/native_message_handler.h" | 20 #include "vm/native_message_handler.h" |
20 #include "vm/object.h" | 21 #include "vm/object.h" |
21 #include "vm/object_store.h" | 22 #include "vm/object_store.h" |
22 #include "vm/port.h" | 23 #include "vm/port.h" |
23 #include "vm/resolver.h" | 24 #include "vm/resolver.h" |
24 #include "vm/snapshot.h" | |
25 #include "vm/stack_frame.h" | 25 #include "vm/stack_frame.h" |
26 #include "vm/timer.h" | 26 #include "vm/timer.h" |
27 #include "vm/verifier.h" | 27 #include "vm/verifier.h" |
28 | 28 |
29 namespace dart { | 29 namespace dart { |
30 | 30 |
31 ThreadLocalKey Api::api_native_key_ = Thread::kUnsetThreadLocalKey; | 31 ThreadLocalKey Api::api_native_key_ = Thread::kUnsetThreadLocalKey; |
32 | 32 |
33 const char* CanonicalFunction(const char* func) { | 33 const char* CanonicalFunction(const char* func) { |
34 if (strncmp(func, "dart::", 6) == 0) { | 34 if (strncmp(func, "dart::", 6) == 0) { |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { | 682 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { |
683 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); | 683 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); |
684 return reinterpret_cast<uint8_t*>(new_ptr); | 684 return reinterpret_cast<uint8_t*>(new_ptr); |
685 } | 685 } |
686 | 686 |
687 | 687 |
688 DART_EXPORT bool Dart_PostIntArray(Dart_Port port_id, | 688 DART_EXPORT bool Dart_PostIntArray(Dart_Port port_id, |
689 intptr_t len, | 689 intptr_t len, |
690 intptr_t* data) { | 690 intptr_t* data) { |
691 uint8_t* buffer = NULL; | 691 uint8_t* buffer = NULL; |
692 MessageWriter writer(&buffer, &allocator); | 692 ApiMessageWriter writer(&buffer, &allocator); |
693 | 693 |
694 writer.WriteMessage(len, data); | 694 writer.WriteMessage(len, data); |
695 | 695 |
696 // Post the message at the given port. | 696 // Post the message at the given port. |
697 return PortMap::PostMessage(new Message( | 697 return PortMap::PostMessage(new Message( |
698 port_id, Message::kIllegalPort, buffer, Message::kNormalPriority)); | 698 port_id, Message::kIllegalPort, buffer, Message::kNormalPriority)); |
699 } | 699 } |
700 | 700 |
701 | 701 |
702 DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* message) { | 702 DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* message) { |
703 uint8_t* buffer = NULL; | 703 uint8_t* buffer = NULL; |
704 MessageWriter writer(&buffer, allocator); | 704 ApiMessageWriter writer(&buffer, allocator); |
705 | 705 |
706 writer.WriteCMessage(message); | 706 writer.WriteCMessage(message); |
707 | 707 |
708 // Post the message at the given port. | 708 // Post the message at the given port. |
709 return PortMap::PostMessage(new Message( | 709 return PortMap::PostMessage(new Message( |
710 port_id, Message::kIllegalPort, buffer, Message::kNormalPriority)); | 710 port_id, Message::kIllegalPort, buffer, Message::kNormalPriority)); |
711 } | 711 } |
712 | 712 |
713 | 713 |
714 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) { | 714 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) { |
(...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2516 *buffer = NULL; | 2516 *buffer = NULL; |
2517 } | 2517 } |
2518 delete debug_region; | 2518 delete debug_region; |
2519 } else { | 2519 } else { |
2520 *buffer = NULL; | 2520 *buffer = NULL; |
2521 *buffer_size = 0; | 2521 *buffer_size = 0; |
2522 } | 2522 } |
2523 } | 2523 } |
2524 | 2524 |
2525 } // namespace dart | 2525 } // namespace dart |
OLD | NEW |