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/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 5173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5184 } | 5184 } |
5185 | 5185 |
5186 | 5186 |
5187 DART_EXPORT Dart_Handle Dart_RootLibrary() { | 5187 DART_EXPORT Dart_Handle Dart_RootLibrary() { |
5188 Isolate* isolate = Isolate::Current(); | 5188 Isolate* isolate = Isolate::Current(); |
5189 CHECK_ISOLATE(isolate); | 5189 CHECK_ISOLATE(isolate); |
5190 return Api::NewHandle(isolate, isolate->object_store()->root_library()); | 5190 return Api::NewHandle(isolate, isolate->object_store()->root_library()); |
5191 } | 5191 } |
5192 | 5192 |
5193 | 5193 |
| 5194 DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library) { |
| 5195 DARTSCOPE(Thread::Current()); |
| 5196 const Library& lib = Api::UnwrapLibraryHandle(Z, library); |
| 5197 if (lib.IsNull()) { |
| 5198 RETURN_TYPE_ERROR(Z, library, Library); |
| 5199 } |
| 5200 Isolate* isolate = Isolate::Current(); |
| 5201 isolate->object_store()->set_root_library(lib); |
| 5202 return library; |
| 5203 } |
| 5204 |
| 5205 |
5194 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, | 5206 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, |
5195 Dart_Handle class_name) { | 5207 Dart_Handle class_name) { |
5196 DARTSCOPE(Thread::Current()); | 5208 DARTSCOPE(Thread::Current()); |
5197 const Library& lib = Api::UnwrapLibraryHandle(Z, library); | 5209 const Library& lib = Api::UnwrapLibraryHandle(Z, library); |
5198 if (lib.IsNull()) { | 5210 if (lib.IsNull()) { |
5199 RETURN_TYPE_ERROR(Z, library, Library); | 5211 RETURN_TYPE_ERROR(Z, library, Library); |
5200 } | 5212 } |
5201 const String& cls_name = Api::UnwrapStringHandle(Z, class_name); | 5213 const String& cls_name = Api::UnwrapStringHandle(Z, class_name); |
5202 if (cls_name.IsNull()) { | 5214 if (cls_name.IsNull()) { |
5203 RETURN_TYPE_ERROR(Z, class_name, String); | 5215 RETURN_TYPE_ERROR(Z, class_name, String); |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6072 ApiReallocate); | 6084 ApiReallocate); |
6073 writer.WriteFullSnapshot(); | 6085 writer.WriteFullSnapshot(); |
6074 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6086 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
6075 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6087 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
6076 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 6088 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |
6077 | 6089 |
6078 return Api::Success(); | 6090 return Api::Success(); |
6079 } | 6091 } |
6080 | 6092 |
6081 } // namespace dart | 6093 } // namespace dart |
OLD | NEW |