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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 343f5979e5eb58182c2db3e23f8a40b3ce59e176..e1c2acacbdeb27286fb118e1a10d79ad1abb2ffd 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -5718,6 +5718,42 @@ DART_EXPORT Dart_Handle Dart_LibraryImportLibrary(Dart_Handle library,
}
+DART_EXPORT Dart_Handle Dart_GetImportsOfScheme(Dart_Handle scheme) {
+ DARTSCOPE(Thread::Current());
+ Isolate* I = T->isolate();
+ const String& scheme_vm = Api::UnwrapStringHandle(Z, scheme);
+ if (scheme_vm.IsNull()) {
+ RETURN_TYPE_ERROR(Z, scheme, String);
+ }
+
+ const GrowableObjectArray& libraries =
+ GrowableObjectArray::Handle(Z, I->object_store()->libraries());
+ const GrowableObjectArray& result =
+ GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
+ Library& importer = Library::Handle(Z);
+ Array& imports = Array::Handle(Z);
+ Namespace& ns = Namespace::Handle(Z);
+ Library& importee = Library::Handle(Z);
+ String& importee_uri = String::Handle(Z);
+ for (intptr_t i = 0; i < libraries.Length(); i++) {
+ importer ^= libraries.At(i);
+ imports = importer.imports();
+ for (intptr_t j = 0; j < imports.Length(); j++) {
+ ns ^= imports.At(j);
+ if (ns.IsNull()) continue;
+ importee = ns.library();
+ importee_uri = importee.url();
+ if (importee_uri.StartsWith(scheme_vm)) {
+ result.Add(importer);
+ result.Add(importee);
+ }
+ }
+ }
+
+ return Api::NewHandle(T, Array::MakeArray(result));
+}
+
+
DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library,
Dart_Handle url,
Dart_Handle resolved_url,

Powered by Google App Engine
This is Rietveld 408576698