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

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

Issue 920813003: Refactor service code and service method parameters (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | « no previous file | 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"
11 #include "vm/debugger.h" 11 #include "vm/debugger.h"
12 #include "vm/flags.h" 12 #include "vm/flags.h"
13 #include "vm/freelist.h" 13 #include "vm/freelist.h"
14 #include "vm/handles.h" 14 #include "vm/handles.h"
15 #include "vm/heap.h" 15 #include "vm/heap.h"
16 #include "vm/isolate.h" 16 #include "vm/isolate.h"
17 #include "vm/metrics.h" 17 #include "vm/metrics.h"
18 #include "vm/object.h" 18 #include "vm/object.h"
19 #include "vm/object_store.h" 19 #include "vm/object_store.h"
20 #include "vm/object_id_ring.h" 20 #include "vm/object_id_ring.h"
21 #include "vm/port.h" 21 #include "vm/port.h"
22 #include "vm/profiler.h" 22 #include "vm/profiler.h"
23 #include "vm/service.h" 23 #include "vm/service_isolate.h"
24 #include "vm/simulator.h" 24 #include "vm/simulator.h"
25 #include "vm/snapshot.h" 25 #include "vm/snapshot.h"
26 #include "vm/stub_code.h" 26 #include "vm/stub_code.h"
27 #include "vm/symbols.h" 27 #include "vm/symbols.h"
28 #include "vm/thread_interrupter.h" 28 #include "vm/thread_interrupter.h"
29 #include "vm/thread_pool.h" 29 #include "vm/thread_pool.h"
30 #include "vm/virtual_memory.h" 30 #include "vm/virtual_memory.h"
31 #include "vm/zone.h" 31 #include "vm/zone.h"
32 32
33 namespace dart { 33 namespace dart {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // 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).
140 Dart_EnterScope(); 140 Dart_EnterScope();
141 Api::InitHandles(); 141 Api::InitHandles();
142 142
143 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. 143 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread.
144 Isolate::SetCreateCallback(create); 144 Isolate::SetCreateCallback(create);
145 Isolate::SetInterruptCallback(interrupt); 145 Isolate::SetInterruptCallback(interrupt);
146 Isolate::SetUnhandledExceptionCallback(unhandled); 146 Isolate::SetUnhandledExceptionCallback(unhandled);
147 Isolate::SetShutdownCallback(shutdown); 147 Isolate::SetShutdownCallback(shutdown);
148 148
149 Service::RunService(); 149 ServiceIsolate::Run();
150 150
151 return NULL; 151 return NULL;
152 } 152 }
153 153
154 154
155 const char* Dart::Cleanup() { 155 const char* Dart::Cleanup() {
156 #if 0 156 #if 0
157 // 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
158 // 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
159 // execution before it terminates, this results in racing isolates. 159 // execution before it terminates, this results in racing isolates.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 254 }
255 isolate->megamorphic_cache_table()->InitMissHandler(); 255 isolate->megamorphic_cache_table()->InitMissHandler();
256 256
257 isolate->heap()->EnableGrowthControl(); 257 isolate->heap()->EnableGrowthControl();
258 isolate->set_init_callback_data(data); 258 isolate->set_init_callback_data(data);
259 Api::SetupAcquiredError(isolate); 259 Api::SetupAcquiredError(isolate);
260 if (FLAG_print_class_table) { 260 if (FLAG_print_class_table) {
261 isolate->class_table()->Print(); 261 isolate->class_table()->Print();
262 } 262 }
263 263
264 Service::MaybeInjectVMServiceLibrary(isolate); 264 ServiceIsolate::MaybeInjectVMServiceLibrary(isolate);
265 265
266 Service::SendIsolateStartupMessage(); 266 ServiceIsolate::SendIsolateStartupMessage();
267 isolate->debugger()->NotifyIsolateCreated(); 267 isolate->debugger()->NotifyIsolateCreated();
268 268
269 // Create tag table. 269 // Create tag table.
270 isolate->set_tag_table( 270 isolate->set_tag_table(
271 GrowableObjectArray::Handle(GrowableObjectArray::New())); 271 GrowableObjectArray::Handle(GrowableObjectArray::New()));
272 // Set up default UserTag. 272 // Set up default UserTag.
273 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag()); 273 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag());
274 isolate->set_current_tag(default_tag); 274 isolate->set_current_tag(default_tag);
275 275
276 return Error::null(); 276 return Error::null();
277 } 277 }
278 278
279 279
280 void Dart::RunShutdownCallback() { 280 void Dart::RunShutdownCallback() {
281 Isolate* isolate = Isolate::Current(); 281 Isolate* isolate = Isolate::Current();
282 void* callback_data = isolate->init_callback_data(); 282 void* callback_data = isolate->init_callback_data();
283 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); 283 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback();
284 Service::SendIsolateShutdownMessage(); 284 ServiceIsolate::SendIsolateShutdownMessage();
285 if (callback != NULL) { 285 if (callback != NULL) {
286 (callback)(callback_data); 286 (callback)(callback_data);
287 } 287 }
288 } 288 }
289 289
290 290
291 void Dart::ShutdownIsolate() { 291 void Dart::ShutdownIsolate() {
292 Isolate* isolate = Isolate::Current(); 292 Isolate* isolate = Isolate::Current();
293 isolate->Shutdown(); 293 isolate->Shutdown();
294 delete isolate; 294 delete isolate;
295 } 295 }
296 296
297 297
298 uword Dart::AllocateReadOnlyHandle() { 298 uword Dart::AllocateReadOnlyHandle() {
299 ASSERT(Isolate::Current() == Dart::vm_isolate()); 299 ASSERT(Isolate::Current() == Dart::vm_isolate());
300 ASSERT(predefined_handles_ != NULL); 300 ASSERT(predefined_handles_ != NULL);
301 return predefined_handles_->handles_.AllocateScopedHandle(); 301 return predefined_handles_->handles_.AllocateScopedHandle();
302 } 302 }
303 303
304 304
305 bool Dart::IsReadOnlyHandle(uword address) { 305 bool Dart::IsReadOnlyHandle(uword address) {
306 ASSERT(predefined_handles_ != NULL); 306 ASSERT(predefined_handles_ != NULL);
307 return predefined_handles_->handles_.IsValidScopedHandle(address); 307 return predefined_handles_->handles_.IsValidScopedHandle(address);
308 } 308 }
309 309
310 } // namespace dart 310 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698