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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 Isolate* isolate = Isolate::Current(); | 391 Isolate* isolate = Isolate::Current(); |
392 void* callback_data = isolate->init_callback_data(); | 392 void* callback_data = isolate->init_callback_data(); |
393 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); | 393 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); |
394 ServiceIsolate::SendIsolateShutdownMessage(); | 394 ServiceIsolate::SendIsolateShutdownMessage(); |
395 if (callback != NULL) { | 395 if (callback != NULL) { |
396 (callback)(callback_data); | 396 (callback)(callback_data); |
397 } | 397 } |
398 } | 398 } |
399 | 399 |
400 | 400 |
| 401 void Dart::ShutdownIsolate(Isolate* isolate) { |
| 402 ASSERT(Isolate::Current() == NULL); |
| 403 // We need to enter the isolate in order to shut it down. |
| 404 Thread::EnterIsolate(isolate); |
| 405 ShutdownIsolate(); |
| 406 // Since the isolate is shutdown and deleted, there is no need to |
| 407 // exit the isolate here. |
| 408 ASSERT(Isolate::Current() == NULL); |
| 409 } |
| 410 |
| 411 |
401 void Dart::ShutdownIsolate() { | 412 void Dart::ShutdownIsolate() { |
402 Isolate* isolate = Isolate::Current(); | 413 Isolate* isolate = Isolate::Current(); |
403 isolate->Shutdown(); | 414 isolate->Shutdown(); |
404 delete isolate; | 415 delete isolate; |
405 } | 416 } |
406 | 417 |
407 | 418 |
408 uword Dart::AllocateReadOnlyHandle() { | 419 uword Dart::AllocateReadOnlyHandle() { |
409 ASSERT(Isolate::Current() == Dart::vm_isolate()); | 420 ASSERT(Isolate::Current() == Dart::vm_isolate()); |
410 ASSERT(predefined_handles_ != NULL); | 421 ASSERT(predefined_handles_ != NULL); |
(...skipping 13 matching lines...) Expand all Loading... |
424 return predefined_handles_->handles_.IsValidScopedHandle(address); | 435 return predefined_handles_->handles_.IsValidScopedHandle(address); |
425 } | 436 } |
426 | 437 |
427 | 438 |
428 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 439 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
429 ASSERT(predefined_handles_ != NULL); | 440 ASSERT(predefined_handles_ != NULL); |
430 return predefined_handles_->api_handles_.IsValidHandle(handle); | 441 return predefined_handles_->api_handles_.IsValidHandle(handle); |
431 } | 442 } |
432 | 443 |
433 } // namespace dart | 444 } // namespace dart |
OLD | NEW |