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 4157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4168 RETURN_NULL_ERROR(buffer); | 4168 RETURN_NULL_ERROR(buffer); |
4169 } | 4169 } |
4170 NoHeapGrowthControlScope no_growth_control; | 4170 NoHeapGrowthControlScope no_growth_control; |
4171 | 4171 |
4172 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); | 4172 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); |
4173 if (!snapshot->IsScriptSnapshot()) { | 4173 if (!snapshot->IsScriptSnapshot()) { |
4174 return Api::NewError("%s expects parameter 'buffer' to be a script type" | 4174 return Api::NewError("%s expects parameter 'buffer' to be a script type" |
4175 " snapshot.", CURRENT_FUNC); | 4175 " snapshot.", CURRENT_FUNC); |
4176 } | 4176 } |
4177 if (snapshot->length() != buffer_len) { | 4177 if (snapshot->length() != buffer_len) { |
4178 return Api::NewError("%s: 'buffer_len' of %" Pd " is not equal to %d which" | 4178 return Api::NewError("%s: 'buffer_len' of %" Pd " is not equal to %" Pd64 |
4179 " is the expected length in the snapshot.", | 4179 " which is the expected length in the snapshot.", |
4180 CURRENT_FUNC, buffer_len, snapshot->length()); | 4180 CURRENT_FUNC, buffer_len, snapshot->length()); |
4181 } | 4181 } |
4182 Library& library = | 4182 Library& library = |
4183 Library::Handle(isolate, isolate->object_store()->root_library()); | 4183 Library::Handle(isolate, isolate->object_store()->root_library()); |
4184 if (!library.IsNull()) { | 4184 if (!library.IsNull()) { |
4185 const String& library_url = String::Handle(isolate, library.url()); | 4185 const String& library_url = String::Handle(isolate, library.url()); |
4186 return Api::NewError("%s: A script has already been loaded from '%s'.", | 4186 return Api::NewError("%s: A script has already been loaded from '%s'.", |
4187 CURRENT_FUNC, library_url.ToCString()); | 4187 CURRENT_FUNC, library_url.ToCString()); |
4188 } | 4188 } |
4189 CHECK_CALLBACK_STATE(isolate); | 4189 CHECK_CALLBACK_STATE(isolate); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4549 } | 4549 } |
4550 | 4550 |
4551 | 4551 |
4552 // --- Service support --- | 4552 // --- Service support --- |
4553 | 4553 |
4554 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) { | 4554 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) { |
4555 return Api::CastIsolate(Service::GetServiceIsolate(callback_data)); | 4555 return Api::CastIsolate(Service::GetServiceIsolate(callback_data)); |
4556 } | 4556 } |
4557 | 4557 |
4558 } // namespace dart | 4558 } // namespace dart |
OLD | NEW |