Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: runtime/vm/dart.cc

Issue 125103004: Move service into VM (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
11 #include "vm/freelist.h" 11 #include "vm/freelist.h"
12 #include "vm/handles.h" 12 #include "vm/handles.h"
13 #include "vm/heap.h" 13 #include "vm/heap.h"
14 #include "vm/isolate.h" 14 #include "vm/isolate.h"
15 #include "vm/object.h" 15 #include "vm/object.h"
16 #include "vm/object_store.h" 16 #include "vm/object_store.h"
17 #include "vm/object_id_ring.h" 17 #include "vm/object_id_ring.h"
18 #include "vm/port.h" 18 #include "vm/port.h"
19 #include "vm/profiler.h" 19 #include "vm/profiler.h"
20 #include "vm/service.h"
20 #include "vm/simulator.h" 21 #include "vm/simulator.h"
21 #include "vm/snapshot.h" 22 #include "vm/snapshot.h"
22 #include "vm/stub_code.h" 23 #include "vm/stub_code.h"
23 #include "vm/symbols.h" 24 #include "vm/symbols.h"
24 #include "vm/thread_interrupter.h" 25 #include "vm/thread_interrupter.h"
25 #include "vm/thread_pool.h" 26 #include "vm/thread_pool.h"
26 #include "vm/virtual_memory.h" 27 #include "vm/virtual_memory.h"
27 #include "vm/zone.h" 28 #include "vm/zone.h"
28 29
29 namespace dart { 30 namespace dart {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 79
79 const char* Dart::InitOnce(Dart_IsolateCreateCallback create, 80 const char* Dart::InitOnce(Dart_IsolateCreateCallback create,
80 Dart_IsolateInterruptCallback interrupt, 81 Dart_IsolateInterruptCallback interrupt,
81 Dart_IsolateUnhandledExceptionCallback unhandled, 82 Dart_IsolateUnhandledExceptionCallback unhandled,
82 Dart_IsolateShutdownCallback shutdown, 83 Dart_IsolateShutdownCallback shutdown,
83 Dart_FileOpenCallback file_open, 84 Dart_FileOpenCallback file_open,
84 Dart_FileReadCallback file_read, 85 Dart_FileReadCallback file_read,
85 Dart_FileWriteCallback file_write, 86 Dart_FileWriteCallback file_write,
86 Dart_FileCloseCallback file_close, 87 Dart_FileCloseCallback file_close,
87 Dart_EntropySource entropy_source) { 88 Dart_EntropySource entropy_source,
89 Dart_ServiceIsolateCreateCallback service_create) {
88 // TODO(iposva): Fix race condition here. 90 // TODO(iposva): Fix race condition here.
89 if (vm_isolate_ != NULL || !Flags::Initialized()) { 91 if (vm_isolate_ != NULL || !Flags::Initialized()) {
90 return "VM already initialized."; 92 return "VM already initialized.";
91 } 93 }
92 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); 94 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close);
93 Isolate::SetEntropySourceCallback(entropy_source); 95 Isolate::SetEntropySourceCallback(entropy_source);
94 OS::InitOnce(); 96 OS::InitOnce();
95 VirtualMemory::InitOnce(); 97 VirtualMemory::InitOnce();
96 Isolate::InitOnce(); 98 Isolate::InitOnce();
97 PortMap::InitOnce(); 99 PortMap::InitOnce();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 vm_isolate_->heap()->WriteProtect(true); 136 vm_isolate_->heap()->WriteProtect(true);
135 } 137 }
136 // There is a planned and known asymmetry here: We enter one scope for the VM 138 // There is a planned and known asymmetry here: We enter one scope for the VM
137 // isolate so that we can allocate the "persistent" scoped handles for the 139 // isolate so that we can allocate the "persistent" scoped handles for the
138 // predefined API values (such as Dart_True, Dart_False and Dart_Null). 140 // predefined API values (such as Dart_True, Dart_False and Dart_Null).
139 Dart_EnterScope(); 141 Dart_EnterScope();
140 Api::InitHandles(); 142 Api::InitHandles();
141 143
142 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. 144 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread.
143 Isolate::SetCreateCallback(create); 145 Isolate::SetCreateCallback(create);
146 Isolate::SetServiceCreateCallback(service_create);
144 Isolate::SetInterruptCallback(interrupt); 147 Isolate::SetInterruptCallback(interrupt);
145 Isolate::SetUnhandledExceptionCallback(unhandled); 148 Isolate::SetUnhandledExceptionCallback(unhandled);
146 Isolate::SetShutdownCallback(shutdown); 149 Isolate::SetShutdownCallback(shutdown);
147 return NULL; 150 return NULL;
148 } 151 }
149 152
150 153
151 const char* Dart::Cleanup() { 154 const char* Dart::Cleanup() {
152 #if 0 155 #if 0
153 // Ideally we should shutdown the VM isolate here, but the thread pool 156 // Ideally we should shutdown the VM isolate here, but the thread pool
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 return predefined_handles_->handles_.AllocateScopedHandle(); 274 return predefined_handles_->handles_.AllocateScopedHandle();
272 } 275 }
273 276
274 277
275 bool Dart::IsReadOnlyHandle(uword address) { 278 bool Dart::IsReadOnlyHandle(uword address) {
276 ASSERT(predefined_handles_ != NULL); 279 ASSERT(predefined_handles_ != NULL);
277 return predefined_handles_->handles_.IsValidScopedHandle(address); 280 return predefined_handles_->handles_.IsValidScopedHandle(address);
278 } 281 }
279 282
280 } // namespace dart 283 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698