| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/dart.h" | 5 #include "vm/dart.h" |
| 6 | 6 |
| 7 #include "vm/code_observers.h" | 7 #include "vm/code_observers.h" |
| 8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
| 9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 const char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot, | 73 const char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot, |
| 74 const uint8_t* instructions_snapshot, | 74 const uint8_t* instructions_snapshot, |
| 75 Dart_IsolateCreateCallback create, | 75 Dart_IsolateCreateCallback create, |
| 76 Dart_IsolateInterruptCallback interrupt, | 76 Dart_IsolateInterruptCallback interrupt, |
| 77 Dart_IsolateUnhandledExceptionCallback unhandled, | 77 Dart_IsolateUnhandledExceptionCallback unhandled, |
| 78 Dart_IsolateShutdownCallback shutdown, | 78 Dart_IsolateShutdownCallback shutdown, |
| 79 Dart_FileOpenCallback file_open, | 79 Dart_FileOpenCallback file_open, |
| 80 Dart_FileReadCallback file_read, | 80 Dart_FileReadCallback file_read, |
| 81 Dart_FileWriteCallback file_write, | 81 Dart_FileWriteCallback file_write, |
| 82 Dart_FileCloseCallback file_close, | 82 Dart_FileCloseCallback file_close, |
| 83 Dart_EntropySource entropy_source) { | 83 Dart_EntropySource entropy_source, |
| 84 Dart_GetVMServiceAssetsArchive get_service_assets) { |
| 84 // TODO(iposva): Fix race condition here. | 85 // TODO(iposva): Fix race condition here. |
| 85 if (vm_isolate_ != NULL || !Flags::Initialized()) { | 86 if (vm_isolate_ != NULL || !Flags::Initialized()) { |
| 86 return "VM already initialized or flags not initialized."; | 87 return "VM already initialized or flags not initialized."; |
| 87 } | 88 } |
| 88 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); | 89 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); |
| 89 Isolate::SetEntropySourceCallback(entropy_source); | 90 Isolate::SetEntropySourceCallback(entropy_source); |
| 90 OS::InitOnce(); | 91 OS::InitOnce(); |
| 91 VirtualMemory::InitOnce(); | 92 VirtualMemory::InitOnce(); |
| 92 Thread::InitOnceBeforeIsolate(); | 93 Thread::InitOnceBeforeIsolate(); |
| 93 Thread::EnsureInit(); | 94 Thread::EnsureInit(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // Allocate the "persistent" scoped handles for the predefined API | 195 // Allocate the "persistent" scoped handles for the predefined API |
| 195 // values (such as Dart_True, Dart_False and Dart_Null). | 196 // values (such as Dart_True, Dart_False and Dart_Null). |
| 196 Api::InitHandles(); | 197 Api::InitHandles(); |
| 197 | 198 |
| 198 Thread::ExitIsolate(); // Unregister the VM isolate from this thread. | 199 Thread::ExitIsolate(); // Unregister the VM isolate from this thread. |
| 199 Isolate::SetCreateCallback(create); | 200 Isolate::SetCreateCallback(create); |
| 200 Isolate::SetInterruptCallback(interrupt); | 201 Isolate::SetInterruptCallback(interrupt); |
| 201 Isolate::SetUnhandledExceptionCallback(unhandled); | 202 Isolate::SetUnhandledExceptionCallback(unhandled); |
| 202 Isolate::SetShutdownCallback(shutdown); | 203 Isolate::SetShutdownCallback(shutdown); |
| 203 | 204 |
| 205 Service::SetGetServiceAssetsCallback(get_service_assets); |
| 204 ServiceIsolate::Run(); | 206 ServiceIsolate::Run(); |
| 205 | 207 |
| 206 return NULL; | 208 return NULL; |
| 207 } | 209 } |
| 208 | 210 |
| 209 | 211 |
| 210 // This waits until only the VM isolate remains in the list. | 212 // This waits until only the VM isolate remains in the list. |
| 211 void Dart::WaitForIsolateShutdown() { | 213 void Dart::WaitForIsolateShutdown() { |
| 212 ASSERT(!Isolate::creation_enabled_); | 214 ASSERT(!Isolate::creation_enabled_); |
| 213 MonitorLocker ml(Isolate::isolates_list_monitor_); | 215 MonitorLocker ml(Isolate::isolates_list_monitor_); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 return predefined_handles_->handles_.IsValidScopedHandle(address); | 423 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 422 } | 424 } |
| 423 | 425 |
| 424 | 426 |
| 425 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 427 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
| 426 ASSERT(predefined_handles_ != NULL); | 428 ASSERT(predefined_handles_ != NULL); |
| 427 return predefined_handles_->api_handles_.IsValidHandle(handle); | 429 return predefined_handles_->api_handles_.IsValidHandle(handle); |
| 428 } | 430 } |
| 429 | 431 |
| 430 } // namespace dart | 432 } // namespace dart |
| OLD | NEW |