| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 Dart_Isolate Api::CastIsolate(Isolate* isolate) { | 172 Dart_Isolate Api::CastIsolate(Isolate* isolate) { |
| 173 return reinterpret_cast<Dart_Isolate>(isolate); | 173 return reinterpret_cast<Dart_Isolate>(isolate); |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| 177 Dart_Handle Api::NewError(const char* format, ...) { | 177 Dart_Handle Api::NewError(const char* format, ...) { |
| 178 Isolate* isolate = Isolate::Current(); | 178 Isolate* isolate = Isolate::Current(); |
| 179 HANDLESCOPE(isolate); | 179 DARTSCOPE(isolate); |
| 180 CHECK_CALLBACK_STATE(isolate); | 180 CHECK_CALLBACK_STATE(isolate); |
| 181 | 181 |
| 182 va_list args; | 182 va_list args; |
| 183 va_start(args, format); | 183 va_start(args, format); |
| 184 intptr_t len = OS::VSNPrint(NULL, 0, format, args); | 184 intptr_t len = OS::VSNPrint(NULL, 0, format, args); |
| 185 va_end(args); | 185 va_end(args); |
| 186 | 186 |
| 187 char* buffer = isolate->current_zone()->Alloc<char>(len + 1); | 187 char* buffer = isolate->current_zone()->Alloc<char>(len + 1); |
| 188 va_list args2; | 188 va_list args2; |
| 189 va_start(args2, format); | 189 va_start(args2, format); |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, | 869 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, |
| 870 const char* main, | 870 const char* main, |
| 871 const uint8_t* snapshot, | 871 const uint8_t* snapshot, |
| 872 void* callback_data, | 872 void* callback_data, |
| 873 char** error) { | 873 char** error) { |
| 874 TRACE_API_CALL(CURRENT_FUNC); | 874 TRACE_API_CALL(CURRENT_FUNC); |
| 875 char* isolate_name = BuildIsolateName(script_uri, main); | 875 char* isolate_name = BuildIsolateName(script_uri, main); |
| 876 Isolate* isolate = Dart::CreateIsolate(isolate_name); | 876 Isolate* isolate = Dart::CreateIsolate(isolate_name); |
| 877 free(isolate_name); | 877 free(isolate_name); |
| 878 { | 878 { |
| 879 START_TIMER(isolate, time_total_runtime); | |
| 880 StackZone zone(isolate); | 879 StackZone zone(isolate); |
| 881 HANDLESCOPE(isolate); | 880 HANDLESCOPE(isolate); |
| 882 const Error& error_obj = | 881 const Error& error_obj = |
| 883 Error::Handle(isolate, | 882 Error::Handle(isolate, |
| 884 Dart::InitializeIsolate(snapshot, callback_data)); | 883 Dart::InitializeIsolate(snapshot, callback_data)); |
| 885 if (error_obj.IsNull()) { | 884 if (error_obj.IsNull()) { |
| 886 START_TIMER(isolate, time_native_execution); | |
| 887 if (FLAG_check_function_fingerprints) { | 885 if (FLAG_check_function_fingerprints) { |
| 888 Library::CheckFunctionFingerprints(); | 886 Library::CheckFunctionFingerprints(); |
| 889 } | 887 } |
| 888 START_TIMER(time_total_runtime); |
| 890 return reinterpret_cast<Dart_Isolate>(isolate); | 889 return reinterpret_cast<Dart_Isolate>(isolate); |
| 891 } | 890 } |
| 892 *error = strdup(error_obj.ToErrorCString()); | 891 *error = strdup(error_obj.ToErrorCString()); |
| 893 } | 892 } |
| 894 STOP_TIMER(isolate, time_native_execution); | |
| 895 STOP_TIMER(isolate, time_total_runtime); | |
| 896 Dart::ShutdownIsolate(); | 893 Dart::ShutdownIsolate(); |
| 897 return reinterpret_cast<Dart_Isolate>(NULL); | 894 return reinterpret_cast<Dart_Isolate>(NULL); |
| 898 } | 895 } |
| 899 | 896 |
| 900 | 897 |
| 901 DART_EXPORT void Dart_ShutdownIsolate() { | 898 DART_EXPORT void Dart_ShutdownIsolate() { |
| 902 Isolate* isolate = Isolate::Current(); | 899 Isolate* isolate = Isolate::Current(); |
| 903 CHECK_ISOLATE(isolate); | 900 CHECK_ISOLATE(isolate); |
| 904 { | 901 { |
| 905 StackZone zone(isolate); | 902 StackZone zone(isolate); |
| 906 HandleScope handle_scope(isolate); | 903 HandleScope handle_scope(isolate); |
| 907 Dart::RunShutdownCallback(); | 904 Dart::RunShutdownCallback(); |
| 908 } | 905 } |
| 909 STOP_TIMER(isolate, time_native_execution); | 906 STOP_TIMER(time_total_runtime); |
| 910 STOP_TIMER(isolate, time_total_runtime); | |
| 911 Dart::ShutdownIsolate(); | 907 Dart::ShutdownIsolate(); |
| 912 } | 908 } |
| 913 | 909 |
| 914 | 910 |
| 915 DART_EXPORT Dart_Isolate Dart_CurrentIsolate() { | 911 DART_EXPORT Dart_Isolate Dart_CurrentIsolate() { |
| 916 return Api::CastIsolate(Isolate::Current()); | 912 return Api::CastIsolate(Isolate::Current()); |
| 917 } | 913 } |
| 918 | 914 |
| 919 | 915 |
| 920 DART_EXPORT void* Dart_CurrentIsolateData() { | 916 DART_EXPORT void* Dart_CurrentIsolateData() { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 intptr_t new_size) { | 958 intptr_t new_size) { |
| 963 return Api::TopScope(Isolate::Current())->zone()->Realloc<uint8_t>( | 959 return Api::TopScope(Isolate::Current())->zone()->Realloc<uint8_t>( |
| 964 ptr, old_size, new_size); | 960 ptr, old_size, new_size); |
| 965 } | 961 } |
| 966 | 962 |
| 967 | 963 |
| 968 DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** buffer, | 964 DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** buffer, |
| 969 intptr_t* size) { | 965 intptr_t* size) { |
| 970 Isolate* isolate = Isolate::Current(); | 966 Isolate* isolate = Isolate::Current(); |
| 971 DARTSCOPE(isolate); | 967 DARTSCOPE(isolate); |
| 972 TIMERSCOPE(isolate, time_creating_snapshot); | 968 TIMERSCOPE(time_creating_snapshot); |
| 973 if (buffer == NULL) { | 969 if (buffer == NULL) { |
| 974 RETURN_NULL_ERROR(buffer); | 970 RETURN_NULL_ERROR(buffer); |
| 975 } | 971 } |
| 976 if (size == NULL) { | 972 if (size == NULL) { |
| 977 RETURN_NULL_ERROR(size); | 973 RETURN_NULL_ERROR(size); |
| 978 } | 974 } |
| 979 Dart_Handle state = Api::CheckIsolateState(isolate); | 975 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 980 if (::Dart_IsError(state)) { | 976 if (::Dart_IsError(state)) { |
| 981 return state; | 977 return state; |
| 982 } | 978 } |
| 983 // Since this is only a snapshot the root library should not be set. | 979 // Since this is only a snapshot the root library should not be set. |
| 984 isolate->object_store()->set_root_library(Library::Handle(isolate)); | 980 isolate->object_store()->set_root_library(Library::Handle(isolate)); |
| 985 FullSnapshotWriter writer(buffer, ApiReallocate); | 981 FullSnapshotWriter writer(buffer, ApiReallocate); |
| 986 writer.WriteFullSnapshot(); | 982 writer.WriteFullSnapshot(); |
| 987 *size = writer.BytesWritten(); | 983 *size = writer.BytesWritten(); |
| 988 return Api::Success(); | 984 return Api::Success(); |
| 989 } | 985 } |
| 990 | 986 |
| 991 | 987 |
| 992 DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** buffer, | 988 DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** buffer, |
| 993 intptr_t* size) { | 989 intptr_t* size) { |
| 994 Isolate* isolate = Isolate::Current(); | 990 Isolate* isolate = Isolate::Current(); |
| 995 DARTSCOPE(isolate); | 991 DARTSCOPE(isolate); |
| 996 TIMERSCOPE(isolate, time_creating_snapshot); | 992 TIMERSCOPE(time_creating_snapshot); |
| 997 if (buffer == NULL) { | 993 if (buffer == NULL) { |
| 998 RETURN_NULL_ERROR(buffer); | 994 RETURN_NULL_ERROR(buffer); |
| 999 } | 995 } |
| 1000 if (size == NULL) { | 996 if (size == NULL) { |
| 1001 RETURN_NULL_ERROR(size); | 997 RETURN_NULL_ERROR(size); |
| 1002 } | 998 } |
| 1003 Dart_Handle state = Api::CheckIsolateState(isolate); | 999 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 1004 if (::Dart_IsError(state)) { | 1000 if (::Dart_IsError(state)) { |
| 1005 return state; | 1001 return state; |
| 1006 } | 1002 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 return Api::Success(); | 1212 return Api::Success(); |
| 1217 } | 1213 } |
| 1218 return Api::NewError("Dart_PostMessage failed."); | 1214 return Api::NewError("Dart_PostMessage failed."); |
| 1219 } | 1215 } |
| 1220 | 1216 |
| 1221 // --- Scopes ---- | 1217 // --- Scopes ---- |
| 1222 | 1218 |
| 1223 DART_EXPORT void Dart_EnterScope() { | 1219 DART_EXPORT void Dart_EnterScope() { |
| 1224 Isolate* isolate = Isolate::Current(); | 1220 Isolate* isolate = Isolate::Current(); |
| 1225 CHECK_ISOLATE(isolate); | 1221 CHECK_ISOLATE(isolate); |
| 1226 NativeToVmTimerScope __temp_isolate_timer__(isolate); | |
| 1227 ApiState* state = isolate->api_state(); | 1222 ApiState* state = isolate->api_state(); |
| 1228 ASSERT(state != NULL); | 1223 ASSERT(state != NULL); |
| 1229 ApiLocalScope* new_scope = state->reusable_scope(); | 1224 ApiLocalScope* new_scope = state->reusable_scope(); |
| 1230 if (new_scope == NULL) { | 1225 if (new_scope == NULL) { |
| 1231 new_scope = new ApiLocalScope(state->top_scope(), | 1226 new_scope = new ApiLocalScope(state->top_scope(), |
| 1232 isolate->top_exit_frame_info()); | 1227 isolate->top_exit_frame_info()); |
| 1233 ASSERT(new_scope != NULL); | 1228 ASSERT(new_scope != NULL); |
| 1234 } else { | 1229 } else { |
| 1235 new_scope->Reinit(isolate, | 1230 new_scope->Reinit(isolate, |
| 1236 state->top_scope(), | 1231 state->top_scope(), |
| (...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3212 } | 3207 } |
| 3213 | 3208 |
| 3214 | 3209 |
| 3215 DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, | 3210 DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, |
| 3216 Dart_Handle name, | 3211 Dart_Handle name, |
| 3217 int number_of_arguments, | 3212 int number_of_arguments, |
| 3218 Dart_Handle* arguments) { | 3213 Dart_Handle* arguments) { |
| 3219 Isolate* isolate = Isolate::Current(); | 3214 Isolate* isolate = Isolate::Current(); |
| 3220 DARTSCOPE(isolate); | 3215 DARTSCOPE(isolate); |
| 3221 CHECK_CALLBACK_STATE(isolate); | 3216 CHECK_CALLBACK_STATE(isolate); |
| 3217 // TODO(turnidge): This is a bit simplistic. It overcounts when |
| 3218 // other operations (gc, compilation) are active. |
| 3219 TIMERSCOPE(time_dart_execution); |
| 3222 | 3220 |
| 3223 const String& function_name = Api::UnwrapStringHandle(isolate, name); | 3221 const String& function_name = Api::UnwrapStringHandle(isolate, name); |
| 3224 if (function_name.IsNull()) { | 3222 if (function_name.IsNull()) { |
| 3225 RETURN_TYPE_ERROR(isolate, name, String); | 3223 RETURN_TYPE_ERROR(isolate, name, String); |
| 3226 } | 3224 } |
| 3227 if (number_of_arguments < 0) { | 3225 if (number_of_arguments < 0) { |
| 3228 return Api::NewError( | 3226 return Api::NewError( |
| 3229 "%s expects argument 'number_of_arguments' to be non-negative.", | 3227 "%s expects argument 'number_of_arguments' to be non-negative.", |
| 3230 CURRENT_FUNC); | 3228 CURRENT_FUNC); |
| 3231 } | 3229 } |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4115 lib.SetLoadError(); | 4113 lib.SetLoadError(); |
| 4116 } | 4114 } |
| 4117 } | 4115 } |
| 4118 } | 4116 } |
| 4119 | 4117 |
| 4120 | 4118 |
| 4121 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, | 4119 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, |
| 4122 Dart_Handle source, | 4120 Dart_Handle source, |
| 4123 intptr_t line_offset, | 4121 intptr_t line_offset, |
| 4124 intptr_t col_offset) { | 4122 intptr_t col_offset) { |
| 4123 TIMERSCOPE(time_script_loading); |
| 4125 Isolate* isolate = Isolate::Current(); | 4124 Isolate* isolate = Isolate::Current(); |
| 4126 TIMERSCOPE(isolate, time_script_loading); | |
| 4127 DARTSCOPE(isolate); | 4125 DARTSCOPE(isolate); |
| 4128 const String& url_str = Api::UnwrapStringHandle(isolate, url); | 4126 const String& url_str = Api::UnwrapStringHandle(isolate, url); |
| 4129 if (url_str.IsNull()) { | 4127 if (url_str.IsNull()) { |
| 4130 RETURN_TYPE_ERROR(isolate, url, String); | 4128 RETURN_TYPE_ERROR(isolate, url, String); |
| 4131 } | 4129 } |
| 4132 const String& source_str = Api::UnwrapStringHandle(isolate, source); | 4130 const String& source_str = Api::UnwrapStringHandle(isolate, source); |
| 4133 if (source_str.IsNull()) { | 4131 if (source_str.IsNull()) { |
| 4134 RETURN_TYPE_ERROR(isolate, source, String); | 4132 RETURN_TYPE_ERROR(isolate, source, String); |
| 4135 } | 4133 } |
| 4136 Library& library = | 4134 Library& library = |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4163 Dart_Handle result; | 4161 Dart_Handle result; |
| 4164 CompileSource(isolate, library, script, &result); | 4162 CompileSource(isolate, library, script, &result); |
| 4165 return result; | 4163 return result; |
| 4166 } | 4164 } |
| 4167 | 4165 |
| 4168 | 4166 |
| 4169 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, | 4167 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, |
| 4170 intptr_t buffer_len) { | 4168 intptr_t buffer_len) { |
| 4171 Isolate* isolate = Isolate::Current(); | 4169 Isolate* isolate = Isolate::Current(); |
| 4172 DARTSCOPE(isolate); | 4170 DARTSCOPE(isolate); |
| 4173 TIMERSCOPE(isolate, time_script_loading); | 4171 TIMERSCOPE(time_script_loading); |
| 4174 if (buffer == NULL) { | 4172 if (buffer == NULL) { |
| 4175 RETURN_NULL_ERROR(buffer); | 4173 RETURN_NULL_ERROR(buffer); |
| 4176 } | 4174 } |
| 4177 NoHeapGrowthControlScope no_growth_control; | 4175 NoHeapGrowthControlScope no_growth_control; |
| 4178 | 4176 |
| 4179 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); | 4177 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); |
| 4180 if (!snapshot->IsScriptSnapshot()) { | 4178 if (!snapshot->IsScriptSnapshot()) { |
| 4181 return Api::NewError("%s expects parameter 'buffer' to be a script type" | 4179 return Api::NewError("%s expects parameter 'buffer' to be a script type" |
| 4182 " snapshot.", CURRENT_FUNC); | 4180 " snapshot.", CURRENT_FUNC); |
| 4183 } | 4181 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4345 return Api::NewError("%s: library '%s' not found.", | 4343 return Api::NewError("%s: library '%s' not found.", |
| 4346 CURRENT_FUNC, url_str.ToCString()); | 4344 CURRENT_FUNC, url_str.ToCString()); |
| 4347 } else { | 4345 } else { |
| 4348 return Api::NewHandle(isolate, library.raw()); | 4346 return Api::NewHandle(isolate, library.raw()); |
| 4349 } | 4347 } |
| 4350 } | 4348 } |
| 4351 | 4349 |
| 4352 | 4350 |
| 4353 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, | 4351 DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url, |
| 4354 Dart_Handle source) { | 4352 Dart_Handle source) { |
| 4353 TIMERSCOPE(time_script_loading); |
| 4355 Isolate* isolate = Isolate::Current(); | 4354 Isolate* isolate = Isolate::Current(); |
| 4356 TIMERSCOPE(isolate, time_script_loading); | |
| 4357 DARTSCOPE(isolate); | 4355 DARTSCOPE(isolate); |
| 4358 const String& url_str = Api::UnwrapStringHandle(isolate, url); | 4356 const String& url_str = Api::UnwrapStringHandle(isolate, url); |
| 4359 if (url_str.IsNull()) { | 4357 if (url_str.IsNull()) { |
| 4360 RETURN_TYPE_ERROR(isolate, url, String); | 4358 RETURN_TYPE_ERROR(isolate, url, String); |
| 4361 } | 4359 } |
| 4362 const String& source_str = Api::UnwrapStringHandle(isolate, source); | 4360 const String& source_str = Api::UnwrapStringHandle(isolate, source); |
| 4363 if (source_str.IsNull()) { | 4361 if (source_str.IsNull()) { |
| 4364 RETURN_TYPE_ERROR(isolate, source, String); | 4362 RETURN_TYPE_ERROR(isolate, source, String); |
| 4365 } | 4363 } |
| 4366 CHECK_CALLBACK_STATE(isolate); | 4364 CHECK_CALLBACK_STATE(isolate); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4437 library_vm.AddObject(library_prefix, prefix_symbol); | 4435 library_vm.AddObject(library_prefix, prefix_symbol); |
| 4438 } | 4436 } |
| 4439 } | 4437 } |
| 4440 return Api::Success(); | 4438 return Api::Success(); |
| 4441 } | 4439 } |
| 4442 | 4440 |
| 4443 | 4441 |
| 4444 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, | 4442 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, |
| 4445 Dart_Handle url, | 4443 Dart_Handle url, |
| 4446 Dart_Handle source) { | 4444 Dart_Handle source) { |
| 4445 TIMERSCOPE(time_script_loading); |
| 4447 Isolate* isolate = Isolate::Current(); | 4446 Isolate* isolate = Isolate::Current(); |
| 4448 TIMERSCOPE(isolate, time_script_loading); | |
| 4449 DARTSCOPE(isolate); | 4447 DARTSCOPE(isolate); |
| 4450 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | 4448 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
| 4451 if (lib.IsNull()) { | 4449 if (lib.IsNull()) { |
| 4452 RETURN_TYPE_ERROR(isolate, library, Library); | 4450 RETURN_TYPE_ERROR(isolate, library, Library); |
| 4453 } | 4451 } |
| 4454 const String& url_str = Api::UnwrapStringHandle(isolate, url); | 4452 const String& url_str = Api::UnwrapStringHandle(isolate, url); |
| 4455 if (url_str.IsNull()) { | 4453 if (url_str.IsNull()) { |
| 4456 RETURN_TYPE_ERROR(isolate, url, String); | 4454 RETURN_TYPE_ERROR(isolate, url, String); |
| 4457 } | 4455 } |
| 4458 const String& source_str = Api::UnwrapStringHandle(isolate, source); | 4456 const String& source_str = Api::UnwrapStringHandle(isolate, source); |
| 4459 if (source_str.IsNull()) { | 4457 if (source_str.IsNull()) { |
| 4460 RETURN_TYPE_ERROR(isolate, source, String); | 4458 RETURN_TYPE_ERROR(isolate, source, String); |
| 4461 } | 4459 } |
| 4462 CHECK_CALLBACK_STATE(isolate); | 4460 CHECK_CALLBACK_STATE(isolate); |
| 4463 | 4461 |
| 4464 NoHeapGrowthControlScope no_growth_control; | 4462 NoHeapGrowthControlScope no_growth_control; |
| 4465 | 4463 |
| 4466 const Script& script = Script::Handle( | 4464 const Script& script = Script::Handle( |
| 4467 isolate, Script::New(url_str, source_str, RawScript::kSourceTag)); | 4465 isolate, Script::New(url_str, source_str, RawScript::kSourceTag)); |
| 4468 Dart_Handle result; | 4466 Dart_Handle result; |
| 4469 CompileSource(isolate, lib, script, &result); | 4467 CompileSource(isolate, lib, script, &result); |
| 4470 return result; | 4468 return result; |
| 4471 } | 4469 } |
| 4472 | 4470 |
| 4473 | 4471 |
| 4474 DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, | 4472 DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, |
| 4475 Dart_Handle url, | 4473 Dart_Handle url, |
| 4476 Dart_Handle patch_source) { | 4474 Dart_Handle patch_source) { |
| 4475 TIMERSCOPE(time_script_loading); |
| 4477 Isolate* isolate = Isolate::Current(); | 4476 Isolate* isolate = Isolate::Current(); |
| 4478 TIMERSCOPE(isolate, time_script_loading); | |
| 4479 DARTSCOPE(isolate); | 4477 DARTSCOPE(isolate); |
| 4480 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | 4478 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
| 4481 if (lib.IsNull()) { | 4479 if (lib.IsNull()) { |
| 4482 RETURN_TYPE_ERROR(isolate, library, Library); | 4480 RETURN_TYPE_ERROR(isolate, library, Library); |
| 4483 } | 4481 } |
| 4484 const String& url_str = Api::UnwrapStringHandle(isolate, url); | 4482 const String& url_str = Api::UnwrapStringHandle(isolate, url); |
| 4485 if (url_str.IsNull()) { | 4483 if (url_str.IsNull()) { |
| 4486 RETURN_TYPE_ERROR(isolate, url, String); | 4484 RETURN_TYPE_ERROR(isolate, url, String); |
| 4487 } | 4485 } |
| 4488 const String& source_str = Api::UnwrapStringHandle(isolate, patch_source); | 4486 const String& source_str = Api::UnwrapStringHandle(isolate, patch_source); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4577 | 4575 |
| 4578 | 4576 |
| 4579 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 4577 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 4580 const char* name, | 4578 const char* name, |
| 4581 Dart_ServiceRequestCallback callback, | 4579 Dart_ServiceRequestCallback callback, |
| 4582 void* user_data) { | 4580 void* user_data) { |
| 4583 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 4581 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
| 4584 } | 4582 } |
| 4585 | 4583 |
| 4586 } // namespace dart | 4584 } // namespace dart |
| OLD | NEW |