| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #ifndef RUNTIME_VM_DART_H_ | 5 #ifndef RUNTIME_VM_DART_H_ |
| 6 #define RUNTIME_VM_DART_H_ | 6 #define RUNTIME_VM_DART_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/snapshot.h" | 10 #include "vm/snapshot.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 // Forward declarations. | 14 // Forward declarations. |
| 15 class DebugInfo; | 15 class DebugInfo; |
| 16 class Isolate; | 16 class Isolate; |
| 17 class LocalHandle; | 17 class LocalHandle; |
| 18 class RawError; | 18 class RawError; |
| 19 class ReadOnlyHandles; | 19 class ReadOnlyHandles; |
| 20 class ThreadPool; | 20 class ThreadPool; |
| 21 | 21 |
| 22 class Dart : public AllStatic { | 22 class Dart : public AllStatic { |
| 23 public: | 23 public: |
| 24 static char* InitOnce( | 24 static char* InitOnce(const uint8_t* vm_isolate_snapshot, |
| 25 const uint8_t* vm_isolate_snapshot, | 25 const uint8_t* instructions_snapshot, |
| 26 const uint8_t* instructions_snapshot, | 26 const uint8_t* data_snapshot, |
| 27 const uint8_t* data_snapshot, | 27 Dart_IsolateCreateCallback create, |
| 28 Dart_IsolateCreateCallback create, | 28 Dart_IsolateShutdownCallback shutdown, |
| 29 Dart_IsolateShutdownCallback shutdown, | 29 Dart_ThreadExitCallback thread_exit, |
| 30 Dart_ThreadExitCallback thread_exit, | 30 Dart_FileOpenCallback file_open, |
| 31 Dart_FileOpenCallback file_open, | 31 Dart_FileReadCallback file_read, |
| 32 Dart_FileReadCallback file_read, | 32 Dart_FileWriteCallback file_write, |
| 33 Dart_FileWriteCallback file_write, | 33 Dart_FileCloseCallback file_close, |
| 34 Dart_FileCloseCallback file_close, | 34 Dart_EntropySource entropy_source, |
| 35 Dart_EntropySource entropy_source, | 35 Dart_GetVMServiceAssetsArchive get_service_assets); |
| 36 Dart_GetVMServiceAssetsArchive get_service_assets); | |
| 37 static const char* Cleanup(); | 36 static const char* Cleanup(); |
| 38 | 37 |
| 39 static Isolate* CreateIsolate(const char* name_prefix, | 38 static Isolate* CreateIsolate(const char* name_prefix, |
| 40 const Dart_IsolateFlags& api_flags); | 39 const Dart_IsolateFlags& api_flags); |
| 41 static RawError* InitializeIsolate(const uint8_t* snapshot, void* data); | 40 static RawError* InitializeIsolate(const uint8_t* snapshot, void* data); |
| 42 static void RunShutdownCallback(); | 41 static void RunShutdownCallback(); |
| 43 static void ShutdownIsolate(Isolate* isolate); | 42 static void ShutdownIsolate(Isolate* isolate); |
| 44 static void ShutdownIsolate(); | 43 static void ShutdownIsolate(); |
| 45 | 44 |
| 46 static Isolate* vm_isolate() { return vm_isolate_; } | 45 static Isolate* vm_isolate() { return vm_isolate_; } |
| 47 static ThreadPool* thread_pool() { return thread_pool_; } | 46 static ThreadPool* thread_pool() { return thread_pool_; } |
| 48 | 47 |
| 49 // Returns a timestamp for use in debugging output in milliseconds | 48 // Returns a timestamp for use in debugging output in milliseconds |
| 50 // since start time. | 49 // since start time. |
| 51 static int64_t timestamp(); | 50 static int64_t timestamp(); |
| 52 | 51 |
| 53 static void set_pprof_symbol_generator(DebugInfo* value) { | 52 static void set_pprof_symbol_generator(DebugInfo* value) { |
| 54 pprof_symbol_generator_ = value; | 53 pprof_symbol_generator_ = value; |
| 55 } | 54 } |
| 56 static DebugInfo* pprof_symbol_generator() { return pprof_symbol_generator_; } | 55 static DebugInfo* pprof_symbol_generator() { return pprof_symbol_generator_; } |
| 57 | 56 |
| 58 static LocalHandle* AllocateReadOnlyApiHandle(); | 57 static LocalHandle* AllocateReadOnlyApiHandle(); |
| 59 static bool IsReadOnlyApiHandle(Dart_Handle handle); | 58 static bool IsReadOnlyApiHandle(Dart_Handle handle); |
| 60 | 59 |
| 61 static uword AllocateReadOnlyHandle(); | 60 static uword AllocateReadOnlyHandle(); |
| 62 static bool IsReadOnlyHandle(uword address); | 61 static bool IsReadOnlyHandle(uword address); |
| 63 | 62 |
| 64 static const char* FeaturesString(Snapshot::Kind kind); | 63 static const char* FeaturesString(Snapshot::Kind kind); |
| 65 | 64 |
| 66 static Snapshot::Kind snapshot_kind() { | 65 static Snapshot::Kind snapshot_kind() { return snapshot_kind_; } |
| 67 return snapshot_kind_; | |
| 68 } | |
| 69 static const uint8_t* instructions_snapshot_buffer() { | 66 static const uint8_t* instructions_snapshot_buffer() { |
| 70 return instructions_snapshot_buffer_; | 67 return instructions_snapshot_buffer_; |
| 71 } | 68 } |
| 72 static void set_instructions_snapshot_buffer(const uint8_t* buffer) { | 69 static void set_instructions_snapshot_buffer(const uint8_t* buffer) { |
| 73 instructions_snapshot_buffer_ = buffer; | 70 instructions_snapshot_buffer_ = buffer; |
| 74 } | 71 } |
| 75 static const uint8_t* data_snapshot_buffer() { | 72 static const uint8_t* data_snapshot_buffer() { return data_snapshot_buffer_; } |
| 76 return data_snapshot_buffer_; | |
| 77 } | |
| 78 static void set_data_snapshot_buffer(const uint8_t* buffer) { | 73 static void set_data_snapshot_buffer(const uint8_t* buffer) { |
| 79 data_snapshot_buffer_ = buffer; | 74 data_snapshot_buffer_ = buffer; |
| 80 } | 75 } |
| 81 | 76 |
| 82 static Dart_ThreadExitCallback thread_exit_callback() { | 77 static Dart_ThreadExitCallback thread_exit_callback() { |
| 83 return thread_exit_callback_; | 78 return thread_exit_callback_; |
| 84 } | 79 } |
| 85 static void set_thread_exit_callback(Dart_ThreadExitCallback cback) { | 80 static void set_thread_exit_callback(Dart_ThreadExitCallback cback) { |
| 86 thread_exit_callback_ = cback; | 81 thread_exit_callback_ = cback; |
| 87 } | 82 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 static Dart_FileOpenCallback file_open_callback_; | 126 static Dart_FileOpenCallback file_open_callback_; |
| 132 static Dart_FileReadCallback file_read_callback_; | 127 static Dart_FileReadCallback file_read_callback_; |
| 133 static Dart_FileWriteCallback file_write_callback_; | 128 static Dart_FileWriteCallback file_write_callback_; |
| 134 static Dart_FileCloseCallback file_close_callback_; | 129 static Dart_FileCloseCallback file_close_callback_; |
| 135 static Dart_EntropySource entropy_source_callback_; | 130 static Dart_EntropySource entropy_source_callback_; |
| 136 }; | 131 }; |
| 137 | 132 |
| 138 } // namespace dart | 133 } // namespace dart |
| 139 | 134 |
| 140 #endif // RUNTIME_VM_DART_H_ | 135 #endif // RUNTIME_VM_DART_H_ |
| OLD | NEW |