Chromium Code Reviews| Index: include/v8.h |
| diff --git a/include/v8.h b/include/v8.h |
| index 38584e8af06efdd848ae92d5c8b8ad412108f528..9764db01548940c16eaaf5ffc7ce887a024252ed 100644 |
| --- a/include/v8.h |
| +++ b/include/v8.h |
| @@ -1071,6 +1071,19 @@ class V8_EXPORT Module { |
| * Returns the completion value. |
| */ |
| V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context); |
| + |
| + /** |
| + * Resolves the promise with the namespace object of the given |
| + * module. |
| + */ |
| + static V8_WARN_UNUSED_RESULT bool FinishDynamicImportSuccess( |
| + Local<Context> context, Local<Promise> promise, Local<Module> module); |
| + |
| + /** |
| + * Rejects the promise with the given exception. |
| + */ |
| + static V8_WARN_UNUSED_RESULT bool FinishDynamicImportFailure( |
| + Local<Context> context, Local<Promise> promise, Local<Value> exception); |
| }; |
| /** |
| @@ -5841,6 +5854,33 @@ typedef void (*CallCompletedCallback)(Isolate*); |
| typedef void (*DeprecatedCallCompletedCallback)(); |
| /** |
| + * HostImportDynamicallyCallback is called when we require the |
| + * embedder to load a module. This is used as part of the dynamic |
| + * import syntax. The behavior of this callback is not specified in |
| + * EcmaScript. |
| + * |
| + * The referrer is the name of the file which calls the dynamic |
| + * import. The referrer can be used to resolve the module location. |
| + * |
| + * The specifier is the name of the module that should be imported. |
| + * |
| + * The promise object is the promise associated with the import |
| + * call. This is either resolved successfully with a module or |
| + * rejected with an exception. |
| + * |
| + * The promise object is opaque to the embedder. The embedder should |
| + * not resolve or reject the promise. Instead, the embedder should |
| + * call FinishDynamicImportSuccess on successful module load or call |
| + * FinishDynamicImportFailure on exception. These two functions will |
| + * resolve or reject the promise. |
| + * |
| + */ |
| +typedef void (*HostImportModuleDynamicallyCallback)(Isolate* isolate, |
| + Local<String> referrer, |
|
jochen (gone - plz use gerrit)
2017/03/22 10:12:28
why not Local<Module> ?
|
| + Local<String> specifier, |
| + Local<Promise> promise); |
| + |
| +/** |
| * PromiseHook with type kInit is called when a new promise is |
| * created. When a new promise is created as part of the chain in the |
| * case of Promise.then or in the intermediate promises created by |
| @@ -6393,7 +6433,8 @@ class V8_EXPORT Isolate { |
| add_histogram_sample_callback(nullptr), |
| array_buffer_allocator(nullptr), |
| external_references(nullptr), |
| - allow_atomics_wait(true) {} |
| + allow_atomics_wait(true), |
| + host_import_module_dynamically_callback_(nullptr) {} |
| /** |
| * The optional entry_hook allows the host application to provide the |
| @@ -6456,6 +6497,16 @@ class V8_EXPORT Isolate { |
| * this isolate. |
| */ |
| bool allow_atomics_wait; |
| + |
| + /** |
| + * This is an unfinished experimental feature, and is only exposed |
| + * here for internal testing purposes. DO NOT USE. |
| + * |
| + * This specifies the callback called by the upcoming dynamic |
| + * import() language feature to load modules. |
| + */ |
| + HostImportModuleDynamicallyCallback |
| + host_import_module_dynamically_callback_; |
| }; |