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

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

Issue 584023004: Service isolate rework (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
« no previous file with comments | « runtime/vm/dart.h ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 75
76 const char* Dart::InitOnce(Dart_IsolateCreateCallback create, 76 const char* Dart::InitOnce(Dart_IsolateCreateCallback create,
77 Dart_IsolateInterruptCallback interrupt, 77 Dart_IsolateInterruptCallback interrupt,
78 Dart_IsolateUnhandledExceptionCallback unhandled, 78 Dart_IsolateUnhandledExceptionCallback unhandled,
79 Dart_IsolateShutdownCallback shutdown, 79 Dart_IsolateShutdownCallback shutdown,
80 Dart_FileOpenCallback file_open, 80 Dart_FileOpenCallback file_open,
81 Dart_FileReadCallback file_read, 81 Dart_FileReadCallback file_read,
82 Dart_FileWriteCallback file_write, 82 Dart_FileWriteCallback file_write,
83 Dart_FileCloseCallback file_close, 83 Dart_FileCloseCallback file_close,
84 Dart_EntropySource entropy_source, 84 Dart_EntropySource entropy_source) {
85 Dart_ServiceIsolateCreateCalback service_create) {
86 // TODO(iposva): Fix race condition here. 85 // TODO(iposva): Fix race condition here.
87 if (vm_isolate_ != NULL || !Flags::Initialized()) { 86 if (vm_isolate_ != NULL || !Flags::Initialized()) {
88 return "VM already initialized or flags not initialized."; 87 return "VM already initialized or flags not initialized.";
89 } 88 }
90 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); 89 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close);
91 Isolate::SetEntropySourceCallback(entropy_source); 90 Isolate::SetEntropySourceCallback(entropy_source);
92 OS::InitOnce(); 91 OS::InitOnce();
93 VirtualMemory::InitOnce(); 92 VirtualMemory::InitOnce();
94 Isolate::InitOnce(); 93 Isolate::InitOnce();
95 PortMap::InitOnce(); 94 PortMap::InitOnce();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 Object::FinalizeVMIsolate(vm_isolate_); 135 Object::FinalizeVMIsolate(vm_isolate_);
137 } 136 }
138 // There is a planned and known asymmetry here: We enter one scope for the VM 137 // There is a planned and known asymmetry here: We enter one scope for the VM
139 // isolate so that we can allocate the "persistent" scoped handles for the 138 // isolate so that we can allocate the "persistent" scoped handles for the
140 // predefined API values (such as Dart_True, Dart_False and Dart_Null). 139 // predefined API values (such as Dart_True, Dart_False and Dart_Null).
141 Dart_EnterScope(); 140 Dart_EnterScope();
142 Api::InitHandles(); 141 Api::InitHandles();
143 142
144 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. 143 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread.
145 Isolate::SetCreateCallback(create); 144 Isolate::SetCreateCallback(create);
146 Isolate::SetServiceCreateCallback(service_create);
147 Isolate::SetInterruptCallback(interrupt); 145 Isolate::SetInterruptCallback(interrupt);
148 Isolate::SetUnhandledExceptionCallback(unhandled); 146 Isolate::SetUnhandledExceptionCallback(unhandled);
149 Isolate::SetShutdownCallback(shutdown); 147 Isolate::SetShutdownCallback(shutdown);
148
149 Service::RunService();
150
150 return NULL; 151 return NULL;
151 } 152 }
152 153
153 154
154 const char* Dart::Cleanup() { 155 const char* Dart::Cleanup() {
155 #if 0 156 #if 0
156 // Ideally we should shutdown the VM isolate here, but the thread pool 157 // Ideally we should shutdown the VM isolate here, but the thread pool
157 // shutdown does not seem to ensure that all the threads have stopped 158 // shutdown does not seem to ensure that all the threads have stopped
158 // execution before it terminates, this results in racing isolates. 159 // execution before it terminates, this results in racing isolates.
159 if (vm_isolate_ == NULL) { 160 if (vm_isolate_ == NULL) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 254 }
254 isolate->megamorphic_cache_table()->InitMissHandler(); 255 isolate->megamorphic_cache_table()->InitMissHandler();
255 256
256 isolate->heap()->EnableGrowthControl(); 257 isolate->heap()->EnableGrowthControl();
257 isolate->set_init_callback_data(data); 258 isolate->set_init_callback_data(data);
258 Api::SetupAcquiredError(isolate); 259 Api::SetupAcquiredError(isolate);
259 if (FLAG_print_class_table) { 260 if (FLAG_print_class_table) {
260 isolate->class_table()->Print(); 261 isolate->class_table()->Print();
261 } 262 }
262 263
264 Service::MaybeInjectVMServiceLibrary(isolate);
265
266 Service::SendIsolateStartupMessage();
263 isolate->debugger()->NotifyIsolateCreated(); 267 isolate->debugger()->NotifyIsolateCreated();
264 Service::SendIsolateStartupMessage(); 268
265 // Create tag table. 269 // Create tag table.
266 isolate->set_tag_table( 270 isolate->set_tag_table(
267 GrowableObjectArray::Handle(GrowableObjectArray::New())); 271 GrowableObjectArray::Handle(GrowableObjectArray::New()));
268 // Set up default UserTag. 272 // Set up default UserTag.
269 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag()); 273 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag());
270 isolate->set_current_tag(default_tag); 274 isolate->set_current_tag(default_tag);
271 275
272 return Error::null(); 276 return Error::null();
273 } 277 }
274 278
(...skipping 22 matching lines...) Expand all
297 return predefined_handles_->handles_.AllocateScopedHandle(); 301 return predefined_handles_->handles_.AllocateScopedHandle();
298 } 302 }
299 303
300 304
301 bool Dart::IsReadOnlyHandle(uword address) { 305 bool Dart::IsReadOnlyHandle(uword address) {
302 ASSERT(predefined_handles_ != NULL); 306 ASSERT(predefined_handles_ != NULL);
303 return predefined_handles_->handles_.IsValidScopedHandle(address); 307 return predefined_handles_->handles_.IsValidScopedHandle(address);
304 } 308 }
305 309
306 } // namespace dart 310 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.h ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698