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 5088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5099 NoHeapGrowthControlScope no_growth_control; | 5099 NoHeapGrowthControlScope no_growth_control; |
5100 | 5100 |
5101 const Script& script = Script::Handle( | 5101 const Script& script = Script::Handle( |
5102 isolate, Script::New(url_str, source_str, RawScript::kPatchTag)); | 5102 isolate, Script::New(url_str, source_str, RawScript::kPatchTag)); |
5103 Dart_Handle result; | 5103 Dart_Handle result; |
5104 CompileSource(isolate, lib, script, &result); | 5104 CompileSource(isolate, lib, script, &result); |
5105 return result; | 5105 return result; |
5106 } | 5106 } |
5107 | 5107 |
5108 | 5108 |
| 5109 // Finalizes classes and invokes Dart core library function that completes |
| 5110 // futures of loadLibrary calls (deferred library loading). |
| 5111 DART_EXPORT Dart_Handle Dart_FinalizeLoading() { |
| 5112 Isolate* isolate = Isolate::Current(); |
| 5113 DARTSCOPE(isolate); |
| 5114 CHECK_CALLBACK_STATE(isolate); |
| 5115 |
| 5116 // Finalize all classes if needed. |
| 5117 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 5118 if (::Dart_IsError(state)) { |
| 5119 return state; |
| 5120 } |
| 5121 |
| 5122 const Library& corelib = Library::Handle(isolate, Library::CoreLibrary()); |
| 5123 const String& function_name = |
| 5124 String::Handle(isolate, String::New("_completeDeferredLoads")); |
| 5125 const Function& function = |
| 5126 Function::Handle(isolate, |
| 5127 corelib.LookupFunctionAllowPrivate(function_name)); |
| 5128 ASSERT(!function.IsNull()); |
| 5129 const Array& args = Array::empty_array(); |
| 5130 |
| 5131 const Object& res = |
| 5132 Object::Handle(isolate, DartEntry::InvokeFunction(function, args)); |
| 5133 if (res.IsError() || res.IsUnhandledException()) { |
| 5134 return Api::NewHandle(isolate, res.raw()); |
| 5135 } |
| 5136 return Api::Success(); |
| 5137 } |
| 5138 |
| 5139 |
5109 DART_EXPORT Dart_Handle Dart_SetNativeResolver( | 5140 DART_EXPORT Dart_Handle Dart_SetNativeResolver( |
5110 Dart_Handle library, | 5141 Dart_Handle library, |
5111 Dart_NativeEntryResolver resolver, | 5142 Dart_NativeEntryResolver resolver, |
5112 Dart_NativeEntrySymbol symbol) { | 5143 Dart_NativeEntrySymbol symbol) { |
5113 Isolate* isolate = Isolate::Current(); | 5144 Isolate* isolate = Isolate::Current(); |
5114 DARTSCOPE(isolate); | 5145 DARTSCOPE(isolate); |
5115 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | 5146 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
5116 if (lib.IsNull()) { | 5147 if (lib.IsNull()) { |
5117 RETURN_TYPE_ERROR(isolate, library, Library); | 5148 RETURN_TYPE_ERROR(isolate, library, Library); |
5118 } | 5149 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5188 | 5219 |
5189 | 5220 |
5190 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5221 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
5191 const char* name, | 5222 const char* name, |
5192 Dart_ServiceRequestCallback callback, | 5223 Dart_ServiceRequestCallback callback, |
5193 void* user_data) { | 5224 void* user_data) { |
5194 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5225 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
5195 } | 5226 } |
5196 | 5227 |
5197 } // namespace dart | 5228 } // namespace dart |
OLD | NEW |