| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 LocalHandles api_handles_; | 66 LocalHandles api_handles_; |
| 67 | 67 |
| 68 friend class Dart; | 68 friend class Dart; |
| 69 DISALLOW_COPY_AND_ASSIGN(ReadOnlyHandles); | 69 DISALLOW_COPY_AND_ASSIGN(ReadOnlyHandles); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 | 72 |
| 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, | |
| 77 Dart_IsolateUnhandledExceptionCallback unhandled, | |
| 78 Dart_IsolateShutdownCallback shutdown, | 76 Dart_IsolateShutdownCallback shutdown, |
| 79 Dart_FileOpenCallback file_open, | 77 Dart_FileOpenCallback file_open, |
| 80 Dart_FileReadCallback file_read, | 78 Dart_FileReadCallback file_read, |
| 81 Dart_FileWriteCallback file_write, | 79 Dart_FileWriteCallback file_write, |
| 82 Dart_FileCloseCallback file_close, | 80 Dart_FileCloseCallback file_close, |
| 83 Dart_EntropySource entropy_source, | 81 Dart_EntropySource entropy_source, |
| 84 Dart_GetVMServiceAssetsArchive get_service_assets) { | 82 Dart_GetVMServiceAssetsArchive get_service_assets) { |
| 85 // TODO(iposva): Fix race condition here. | 83 // TODO(iposva): Fix race condition here. |
| 86 if (vm_isolate_ != NULL || !Flags::Initialized()) { | 84 if (vm_isolate_ != NULL || !Flags::Initialized()) { |
| 87 return "VM already initialized or flags not initialized."; | 85 return "VM already initialized or flags not initialized."; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 #if defined(DEBUG) | 188 #if defined(DEBUG) |
| 191 vm_isolate_->heap()->Verify(kRequireMarked); | 189 vm_isolate_->heap()->Verify(kRequireMarked); |
| 192 #endif | 190 #endif |
| 193 } | 191 } |
| 194 // Allocate the "persistent" scoped handles for the predefined API | 192 // Allocate the "persistent" scoped handles for the predefined API |
| 195 // values (such as Dart_True, Dart_False and Dart_Null). | 193 // values (such as Dart_True, Dart_False and Dart_Null). |
| 196 Api::InitHandles(); | 194 Api::InitHandles(); |
| 197 | 195 |
| 198 Thread::ExitIsolate(); // Unregister the VM isolate from this thread. | 196 Thread::ExitIsolate(); // Unregister the VM isolate from this thread. |
| 199 Isolate::SetCreateCallback(create); | 197 Isolate::SetCreateCallback(create); |
| 200 Isolate::SetInterruptCallback(interrupt); | |
| 201 Isolate::SetUnhandledExceptionCallback(unhandled); | |
| 202 Isolate::SetShutdownCallback(shutdown); | 198 Isolate::SetShutdownCallback(shutdown); |
| 203 | 199 |
| 204 Service::SetGetServiceAssetsCallback(get_service_assets); | 200 Service::SetGetServiceAssetsCallback(get_service_assets); |
| 205 ServiceIsolate::Run(); | 201 ServiceIsolate::Run(); |
| 206 | 202 |
| 207 return NULL; | 203 return NULL; |
| 208 } | 204 } |
| 209 | 205 |
| 210 | 206 |
| 211 // This waits until only the VM isolate remains in the list. | 207 // This waits until only the VM isolate remains in the list. |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 return predefined_handles_->handles_.IsValidScopedHandle(address); | 434 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 439 } | 435 } |
| 440 | 436 |
| 441 | 437 |
| 442 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 438 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
| 443 ASSERT(predefined_handles_ != NULL); | 439 ASSERT(predefined_handles_ != NULL); |
| 444 return predefined_handles_->api_handles_.IsValidHandle(handle); | 440 return predefined_handles_->api_handles_.IsValidHandle(handle); |
| 445 } | 441 } |
| 446 | 442 |
| 447 } // namespace dart | 443 } // namespace dart |
| OLD | NEW |