Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 2475523002: Reload native extensions when starting from a snapshot. (Closed)
Patch Set: comment Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 5700 matching lines...) Expand 10 before | Expand all | Expand 10 after
5711 } else { 5711 } else {
5712 library_prefix = 5712 library_prefix =
5713 LibraryPrefix::New(prefix_symbol, import_ns, false, library_vm); 5713 LibraryPrefix::New(prefix_symbol, import_ns, false, library_vm);
5714 library_vm.AddObject(library_prefix, prefix_symbol); 5714 library_vm.AddObject(library_prefix, prefix_symbol);
5715 } 5715 }
5716 } 5716 }
5717 return Api::Success(); 5717 return Api::Success();
5718 } 5718 }
5719 5719
5720 5720
5721 DART_EXPORT Dart_Handle Dart_GetImportsOfScheme(Dart_Handle scheme) {
5722 DARTSCOPE(Thread::Current());
5723 Isolate* I = T->isolate();
5724 const String& scheme_vm = Api::UnwrapStringHandle(Z, scheme);
5725 if (scheme_vm.IsNull()) {
5726 RETURN_TYPE_ERROR(Z, scheme, String);
5727 }
5728
5729 const GrowableObjectArray& libraries =
5730 GrowableObjectArray::Handle(Z, I->object_store()->libraries());
5731 const GrowableObjectArray& result =
5732 GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
5733 Library& importer = Library::Handle(Z);
5734 Array& imports = Array::Handle(Z);
5735 Namespace& ns = Namespace::Handle(Z);
5736 Library& importee = Library::Handle(Z);
5737 String& importee_uri = String::Handle(Z);
5738 for (intptr_t i = 0; i < libraries.Length(); i++) {
5739 importer ^= libraries.At(i);
5740 imports = importer.imports();
5741 for (intptr_t j = 0; j < imports.Length(); j++) {
5742 ns ^= imports.At(j);
5743 if (ns.IsNull()) continue;
5744 importee = ns.library();
5745 importee_uri = importee.url();
5746 if (importee_uri.StartsWith(scheme_vm)) {
5747 result.Add(importer);
5748 result.Add(importee);
5749 }
5750 }
5751 }
5752
5753 return Api::NewHandle(T, Array::MakeArray(result));
5754 }
5755
5756
5721 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library, 5757 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library,
5722 Dart_Handle url, 5758 Dart_Handle url,
5723 Dart_Handle resolved_url, 5759 Dart_Handle resolved_url,
5724 Dart_Handle source, 5760 Dart_Handle source,
5725 intptr_t line_offset, 5761 intptr_t line_offset,
5726 intptr_t column_offset) { 5762 intptr_t column_offset) {
5727 API_TIMELINE_DURATION; 5763 API_TIMELINE_DURATION;
5728 DARTSCOPE(Thread::Current()); 5764 DARTSCOPE(Thread::Current());
5729 Isolate* I = T->isolate(); 5765 Isolate* I = T->isolate();
5730 const Library& lib = Api::UnwrapLibraryHandle(Z, library); 5766 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
6635 6671
6636 DART_EXPORT bool Dart_IsPrecompiledRuntime() { 6672 DART_EXPORT bool Dart_IsPrecompiledRuntime() {
6637 #if defined(DART_PRECOMPILED_RUNTIME) 6673 #if defined(DART_PRECOMPILED_RUNTIME)
6638 return true; 6674 return true;
6639 #else 6675 #else
6640 return false; 6676 return false;
6641 #endif 6677 #endif
6642 } 6678 }
6643 6679
6644 } // namespace dart 6680 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698