| 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 5152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5163 const Script& script = Script::Handle( | 5163 const Script& script = Script::Handle( |
| 5164 isolate, Script::New(url_str, source_str, RawScript::kPatchTag)); | 5164 isolate, Script::New(url_str, source_str, RawScript::kPatchTag)); |
| 5165 Dart_Handle result; | 5165 Dart_Handle result; |
| 5166 CompileSource(isolate, lib, script, &result); | 5166 CompileSource(isolate, lib, script, &result); |
| 5167 return result; | 5167 return result; |
| 5168 } | 5168 } |
| 5169 | 5169 |
| 5170 | 5170 |
| 5171 // Finalizes classes and invokes Dart core library function that completes | 5171 // Finalizes classes and invokes Dart core library function that completes |
| 5172 // futures of loadLibrary calls (deferred library loading). | 5172 // futures of loadLibrary calls (deferred library loading). |
| 5173 DART_EXPORT Dart_Handle Dart_FinalizeLoading() { | 5173 DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures) { |
| 5174 Isolate* isolate = Isolate::Current(); | 5174 Isolate* isolate = Isolate::Current(); |
| 5175 DARTSCOPE(isolate); | 5175 DARTSCOPE(isolate); |
| 5176 CHECK_CALLBACK_STATE(isolate); | 5176 CHECK_CALLBACK_STATE(isolate); |
| 5177 | 5177 |
| 5178 isolate->DoneLoading(); | 5178 isolate->DoneLoading(); |
| 5179 | 5179 |
| 5180 // TODO(hausner): move the remaining code below (finalization and | 5180 // TODO(hausner): move the remaining code below (finalization and |
| 5181 // invoing of _completeDeferredLoads) into Isolate::DoneLoading(). | 5181 // invoing of _completeDeferredLoads) into Isolate::DoneLoading(). |
| 5182 | 5182 |
| 5183 // Finalize all classes if needed. | 5183 // Finalize all classes if needed. |
| 5184 Dart_Handle state = Api::CheckIsolateState(isolate); | 5184 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 5185 if (::Dart_IsError(state)) { | 5185 if (::Dart_IsError(state)) { |
| 5186 return state; | 5186 return state; |
| 5187 } | 5187 } |
| 5188 | 5188 |
| 5189 const Library& corelib = Library::Handle(isolate, Library::CoreLibrary()); | 5189 if (complete_futures) { |
| 5190 const String& function_name = | 5190 const Library& corelib = Library::Handle(isolate, Library::CoreLibrary()); |
| 5191 String::Handle(isolate, String::New("_completeDeferredLoads")); | 5191 const String& function_name = |
| 5192 const Function& function = | 5192 String::Handle(isolate, String::New("_completeDeferredLoads")); |
| 5193 Function::Handle(isolate, | 5193 const Function& function = |
| 5194 corelib.LookupFunctionAllowPrivate(function_name)); | 5194 Function::Handle(isolate, |
| 5195 ASSERT(!function.IsNull()); | 5195 corelib.LookupFunctionAllowPrivate(function_name)); |
| 5196 const Array& args = Array::empty_array(); | 5196 ASSERT(!function.IsNull()); |
| 5197 const Array& args = Array::empty_array(); |
| 5197 | 5198 |
| 5198 const Object& res = | 5199 const Object& res = |
| 5199 Object::Handle(isolate, DartEntry::InvokeFunction(function, args)); | 5200 Object::Handle(isolate, DartEntry::InvokeFunction(function, args)); |
| 5200 if (res.IsError() || res.IsUnhandledException()) { | 5201 if (res.IsError() || res.IsUnhandledException()) { |
| 5201 return Api::NewHandle(isolate, res.raw()); | 5202 return Api::NewHandle(isolate, res.raw()); |
| 5203 } |
| 5202 } | 5204 } |
| 5203 return Api::Success(); | 5205 return Api::Success(); |
| 5204 } | 5206 } |
| 5205 | 5207 |
| 5206 | 5208 |
| 5207 DART_EXPORT Dart_Handle Dart_SetNativeResolver( | 5209 DART_EXPORT Dart_Handle Dart_SetNativeResolver( |
| 5208 Dart_Handle library, | 5210 Dart_Handle library, |
| 5209 Dart_NativeEntryResolver resolver, | 5211 Dart_NativeEntryResolver resolver, |
| 5210 Dart_NativeEntrySymbol symbol) { | 5212 Dart_NativeEntrySymbol symbol) { |
| 5211 Isolate* isolate = Isolate::Current(); | 5213 Isolate* isolate = Isolate::Current(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5286 | 5288 |
| 5287 | 5289 |
| 5288 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5290 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 5289 const char* name, | 5291 const char* name, |
| 5290 Dart_ServiceRequestCallback callback, | 5292 Dart_ServiceRequestCallback callback, |
| 5291 void* user_data) { | 5293 void* user_data) { |
| 5292 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5294 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
| 5293 } | 5295 } |
| 5294 | 5296 |
| 5295 } // namespace dart | 5297 } // namespace dart |
| OLD | NEW |