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

Unified Diff: src/isolate.cc

Issue 2703563002: [ESNext] Implement DynamicImportCall (Closed)
Patch Set: rebase Created 3 years, 8 months 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
« no previous file with comments | « src/isolate.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index c3d2ed3d3a31e60a4a121078518ed71ea5d742c1..96ae02ac63bba07cdc78b5f287a5692b55df1a0d 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -3345,6 +3345,29 @@ void Isolate::DebugStateUpdated() {
promise_hook_or_debug_is_active_ = promise_hook_ || debug()->is_active();
}
+void Isolate::RunHostImportModuleDynamicallyCallback(
+ Handle<String> source_url, Handle<String> specifier,
+ Handle<JSPromise> promise) {
+ auto result = v8::Utils::PromiseToDynamicImportResult(promise);
+ if (host_import_module_dynamically_callback_ == nullptr) {
+ Handle<Object> exception =
+ factory()->NewError(error_function(), MessageTemplate::kUnsupported);
+ CHECK(result->FinishDynamicImportFailure(
+ v8::Utils::ToLocal(handle(context(), this)),
+ v8::Utils::ToLocal(exception)));
+ return;
+ }
+
+ host_import_module_dynamically_callback_(
+ reinterpret_cast<v8::Isolate*>(this), v8::Utils::ToLocal(source_url),
+ v8::Utils::ToLocal(specifier), result);
+}
+
+void Isolate::SetHostImportModuleDynamicallyCallback(
+ HostImportModuleDynamicallyCallback callback) {
+ host_import_module_dynamically_callback_ = callback;
+}
+
void Isolate::SetPromiseHook(PromiseHook hook) {
promise_hook_ = hook;
DebugStateUpdated();
« no previous file with comments | « src/isolate.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698