Chromium Code Reviews| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 4730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4741 Dart_Handle* result) { | 4741 Dart_Handle* result) { |
| 4742 bool update_lib_status = (script.kind() == RawScript::kScriptTag || | 4742 bool update_lib_status = (script.kind() == RawScript::kScriptTag || |
| 4743 script.kind() == RawScript::kLibraryTag); | 4743 script.kind() == RawScript::kLibraryTag); |
| 4744 if (update_lib_status) { | 4744 if (update_lib_status) { |
| 4745 lib.SetLoadInProgress(); | 4745 lib.SetLoadInProgress(); |
| 4746 } | 4746 } |
| 4747 ASSERT(isolate != NULL); | 4747 ASSERT(isolate != NULL); |
| 4748 const Error& error = Error::Handle(isolate, Compiler::Compile(lib, script)); | 4748 const Error& error = Error::Handle(isolate, Compiler::Compile(lib, script)); |
| 4749 if (error.IsNull()) { | 4749 if (error.IsNull()) { |
| 4750 *result = Api::NewHandle(isolate, lib.raw()); | 4750 *result = Api::NewHandle(isolate, lib.raw()); |
| 4751 if (update_lib_status) { | |
| 4752 lib.SetLoaded(); | |
| 4753 } | |
| 4754 } else { | 4751 } else { |
| 4755 *result = Api::NewHandle(isolate, error.raw()); | 4752 *result = Api::NewHandle(isolate, error.raw()); |
| 4756 if (update_lib_status) { | 4753 lib.SetLoadError(); |
| 4757 lib.SetLoadError(); | |
| 4758 } | |
| 4759 } | 4754 } |
| 4760 } | 4755 } |
| 4761 | 4756 |
| 4762 | 4757 |
| 4763 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, | 4758 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, |
| 4764 Dart_Handle source, | 4759 Dart_Handle source, |
| 4765 intptr_t line_offset, | 4760 intptr_t line_offset, |
| 4766 intptr_t col_offset) { | 4761 intptr_t col_offset) { |
| 4767 Isolate* isolate = Isolate::Current(); | 4762 Isolate* isolate = Isolate::Current(); |
| 4768 DARTSCOPE(isolate); | 4763 DARTSCOPE(isolate); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5144 } | 5139 } |
| 5145 | 5140 |
| 5146 | 5141 |
| 5147 // Finalizes classes and invokes Dart core library function that completes | 5142 // Finalizes classes and invokes Dart core library function that completes |
| 5148 // futures of loadLibrary calls (deferred library loading). | 5143 // futures of loadLibrary calls (deferred library loading). |
| 5149 DART_EXPORT Dart_Handle Dart_FinalizeLoading() { | 5144 DART_EXPORT Dart_Handle Dart_FinalizeLoading() { |
| 5150 Isolate* isolate = Isolate::Current(); | 5145 Isolate* isolate = Isolate::Current(); |
| 5151 DARTSCOPE(isolate); | 5146 DARTSCOPE(isolate); |
| 5152 CHECK_CALLBACK_STATE(isolate); | 5147 CHECK_CALLBACK_STATE(isolate); |
| 5153 | 5148 |
| 5149 isolate->DoneLoading(); | |
|
Ivan Posva
2014/06/26 08:37:46
We should consider moving all of the code below in
hausner
2014/06/30 17:18:43
Added a TODO.
| |
| 5150 | |
| 5154 // Finalize all classes if needed. | 5151 // Finalize all classes if needed. |
| 5155 Dart_Handle state = Api::CheckIsolateState(isolate); | 5152 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 5156 if (::Dart_IsError(state)) { | 5153 if (::Dart_IsError(state)) { |
| 5157 return state; | 5154 return state; |
| 5158 } | 5155 } |
| 5159 | 5156 |
| 5160 const Library& corelib = Library::Handle(isolate, Library::CoreLibrary()); | 5157 const Library& corelib = Library::Handle(isolate, Library::CoreLibrary()); |
| 5161 const String& function_name = | 5158 const String& function_name = |
| 5162 String::Handle(isolate, String::New("_completeDeferredLoads")); | 5159 String::Handle(isolate, String::New("_completeDeferredLoads")); |
| 5163 const Function& function = | 5160 const Function& function = |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5257 | 5254 |
| 5258 | 5255 |
| 5259 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5256 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 5260 const char* name, | 5257 const char* name, |
| 5261 Dart_ServiceRequestCallback callback, | 5258 Dart_ServiceRequestCallback callback, |
| 5262 void* user_data) { | 5259 void* user_data) { |
| 5263 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5260 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
| 5264 } | 5261 } |
| 5265 | 5262 |
| 5266 } // namespace dart | 5263 } // namespace dart |
| OLD | NEW |