| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 | 578 |
| 579 // --- Isolates --- | 579 // --- Isolates --- |
| 580 | 580 |
| 581 | 581 |
| 582 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* name_prefix, | 582 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* name_prefix, |
| 583 const uint8_t* snapshot, | 583 const uint8_t* snapshot, |
| 584 void* callback_data, | 584 void* callback_data, |
| 585 char** error) { | 585 char** error) { |
| 586 Isolate* isolate = Dart::CreateIsolate(name_prefix); | 586 Isolate* isolate = Dart::CreateIsolate(name_prefix); |
| 587 assert(isolate != NULL); | 587 assert(isolate != NULL); |
| 588 DARTSCOPE_NOCHECKS(isolate); | 588 { |
| 589 const Error& error_obj = | 589 DARTSCOPE_NOCHECKS(isolate); |
| 590 Error::Handle(Dart::InitializeIsolate(snapshot, callback_data)); | 590 const Error& error_obj = |
| 591 if (error_obj.IsNull()) { | 591 Error::Handle(Dart::InitializeIsolate(snapshot, callback_data)); |
| 592 START_TIMER(time_total_runtime); | 592 if (error_obj.IsNull()) { |
| 593 return reinterpret_cast<Dart_Isolate>(isolate); | 593 START_TIMER(time_total_runtime); |
| 594 } else { | 594 return reinterpret_cast<Dart_Isolate>(isolate); |
| 595 } |
| 595 *error = strdup(error_obj.ToErrorCString()); | 596 *error = strdup(error_obj.ToErrorCString()); |
| 596 Dart::ShutdownIsolate(); | |
| 597 return reinterpret_cast<Dart_Isolate>(NULL); | |
| 598 } | 597 } |
| 598 Dart::ShutdownIsolate(); |
| 599 return reinterpret_cast<Dart_Isolate>(NULL); |
| 599 } | 600 } |
| 600 | 601 |
| 601 | 602 |
| 602 DART_EXPORT void Dart_ShutdownIsolate() { | 603 DART_EXPORT void Dart_ShutdownIsolate() { |
| 603 CHECK_ISOLATE(Isolate::Current()); | 604 CHECK_ISOLATE(Isolate::Current()); |
| 604 STOP_TIMER(time_total_runtime); | 605 STOP_TIMER(time_total_runtime); |
| 605 Dart::ShutdownIsolate(); | 606 Dart::ShutdownIsolate(); |
| 606 } | 607 } |
| 607 | 608 |
| 608 | 609 |
| (...skipping 2477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3086 *buffer = NULL; | 3087 *buffer = NULL; |
| 3087 } | 3088 } |
| 3088 delete debug_region; | 3089 delete debug_region; |
| 3089 } else { | 3090 } else { |
| 3090 *buffer = NULL; | 3091 *buffer = NULL; |
| 3091 *buffer_size = 0; | 3092 *buffer_size = 0; |
| 3092 } | 3093 } |
| 3093 } | 3094 } |
| 3094 | 3095 |
| 3095 } // namespace dart | 3096 } // namespace dart |
| OLD | NEW |