[vm/extensions] Fix Loader::ReloadNativeExtensions(...).

This method was not doing anything since the switch to Dart 2
because extensions no longer were added as imports to the libraries
which loaded them.

This is a commandeer of https://dart-review.googlesource.com/c/sdk/+/90240 with a bug fix.

Change-Id: Idfe2ec16ae714b5a31ed53332da6704248949915
Reviewed-on: https://dart-review.googlesource.com/c/92180
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Samir Jindel 2019-02-11 16:52:20 +00:00 committed by commit-bot@chromium.org
parent a988ed06bd
commit 4118d3c793
3 changed files with 13 additions and 7 deletions

View file

@ -614,6 +614,15 @@ void KernelLoader::LoadNativeExtensionLibraries(
if (result.IsError()) {
H.ReportError(Error::Cast(result), "library handler failed");
}
// Create a dummy library and add it as an import to the current library.
// This allows later to discover and reload this native extension, e.g.
// when running from an app-jit snapshot.
// See Loader::ReloadNativeExtensions(...) which relies on
// Dart_GetImportsOfScheme('dart-ext').
const auto& native_library = Library::Handle(Library::New(uri_path));
library.AddImport(Namespace::Handle(Namespace::New(
native_library, Array::null_array(), Array::null_array())));
}
}
potential_extension_libraries_ = GrowableObjectArray::null();

View file

@ -13,7 +13,7 @@ class RandomArray {
static SendPort _port;
Future<List<int>> randomArray(int seed, int length) {
var completer = new Completer();
var completer = new Completer<List<int>>();
var replyPort = new RawReceivePort();
var args = new List(3);
args[0] = seed;

View file

@ -8,9 +8,6 @@ sample_extension/test/*: Skip # Issue 14705
[ $builder_tag == optimization_counter_threshold ]
sample_extension/test/sample_extension_app_snapshot_test: SkipByDesign # This test is too slow for testing with low optimization counter threshold.
[ $compiler == app_jit ]
sample_extension/test/sample_extension_app_snapshot_test: RuntimeError
[ $compiler == precompiler ]
sample_extension/test/*: Skip # These tests attempt to spawn another script using the precompiled runtime.
@ -26,9 +23,9 @@ sample_extension/test/sample_extension_app_snapshot_test: Pass, RuntimeError # I
[ !$preview_dart_2 && ($runtime == dart_precompiled || $runtime == vm) ]
*: SkipByDesign # Deprecating all Dart1 modes of execution
[ $compiler == app_jitk || $compiler == dartk || $compiler == dartkb || $compiler == dartkp ]
sample_extension/test/sample_extension_app_snapshot_test: RuntimeError
sample_extension/test/sample_extension_test: RuntimeError
[ $compiler == app_jitk || $compiler == dartkb || $compiler == dartkp ]
sample_extension/test/sample_extension_app_snapshot_test: SkipByDesign
sample_extension/test/sample_extension_test: SkipByDesign
# Skip tests that use dart:io
[ $runtime == d8 || $browser ]