OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1064 */ | 1064 */ |
1065 V8_WARN_UNUSED_RESULT bool Instantiate(Local<Context> context, | 1065 V8_WARN_UNUSED_RESULT bool Instantiate(Local<Context> context, |
1066 ResolveCallback callback); | 1066 ResolveCallback callback); |
1067 | 1067 |
1068 /** | 1068 /** |
1069 * ModuleEvaluation | 1069 * ModuleEvaluation |
1070 * | 1070 * |
1071 * Returns the completion value. | 1071 * Returns the completion value. |
1072 */ | 1072 */ |
1073 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context); | 1073 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context); |
1074 | |
1075 /** | |
1076 * Resolves the promise with the namespace object of the given | |
1077 * module. | |
1078 */ | |
1079 static V8_WARN_UNUSED_RESULT bool FinishDynamicImportSuccess( | |
1080 Local<Context> context, Local<Promise> promise, Local<Module> module); | |
1081 | |
1082 /** | |
1083 * Rejects the promise with the given exception. | |
1084 */ | |
1085 static V8_WARN_UNUSED_RESULT bool FinishDynamicImportFailure( | |
1086 Local<Context> context, Local<Promise> promise, Local<Value> exception); | |
1074 }; | 1087 }; |
1075 | 1088 |
1076 /** | 1089 /** |
1077 * A compiled JavaScript script, tied to a Context which was active when the | 1090 * A compiled JavaScript script, tied to a Context which was active when the |
1078 * script was compiled. | 1091 * script was compiled. |
1079 */ | 1092 */ |
1080 class V8_EXPORT Script { | 1093 class V8_EXPORT Script { |
1081 public: | 1094 public: |
1082 /** | 1095 /** |
1083 * A shorthand for ScriptCompiler::Compile(). | 1096 * A shorthand for ScriptCompiler::Compile(). |
(...skipping 4750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5834 kAllocationActionFree = 1 << 1, | 5847 kAllocationActionFree = 1 << 1, |
5835 kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFree | 5848 kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFree |
5836 }; | 5849 }; |
5837 | 5850 |
5838 // --- Enter/Leave Script Callback --- | 5851 // --- Enter/Leave Script Callback --- |
5839 typedef void (*BeforeCallEnteredCallback)(Isolate*); | 5852 typedef void (*BeforeCallEnteredCallback)(Isolate*); |
5840 typedef void (*CallCompletedCallback)(Isolate*); | 5853 typedef void (*CallCompletedCallback)(Isolate*); |
5841 typedef void (*DeprecatedCallCompletedCallback)(); | 5854 typedef void (*DeprecatedCallCompletedCallback)(); |
5842 | 5855 |
5843 /** | 5856 /** |
5857 * HostImportDynamicallyCallback is called when we require the | |
5858 * embedder to load a module. This is used as part of the dynamic | |
5859 * import syntax. The behavior of this callback is not specified in | |
5860 * EcmaScript. | |
5861 * | |
5862 * The referrer is the name of the file which calls the dynamic | |
5863 * import. The referrer can be used to resolve the module location. | |
5864 * | |
5865 * The specifier is the name of the module that should be imported. | |
5866 * | |
5867 * The promise object is the promise associated with the import | |
5868 * call. This is either resolved successfully with a module or | |
5869 * rejected with an exception. | |
5870 * | |
5871 * The promise object is opaque to the embedder. The embedder should | |
5872 * not resolve or reject the promise. Instead, the embedder should | |
5873 * call FinishDynamicImportSuccess on successful module load or call | |
5874 * FinishDynamicImportFailure on exception. These two functions will | |
5875 * resolve or reject the promise. | |
5876 * | |
5877 */ | |
5878 typedef void (*HostImportModuleDynamicallyCallback)(Isolate* isolate, | |
5879 Local<String> referrer, | |
jochen (gone - plz use gerrit)
2017/03/22 10:12:28
why not Local<Module> ?
| |
5880 Local<String> specifier, | |
5881 Local<Promise> promise); | |
5882 | |
5883 /** | |
5844 * PromiseHook with type kInit is called when a new promise is | 5884 * PromiseHook with type kInit is called when a new promise is |
5845 * created. When a new promise is created as part of the chain in the | 5885 * created. When a new promise is created as part of the chain in the |
5846 * case of Promise.then or in the intermediate promises created by | 5886 * case of Promise.then or in the intermediate promises created by |
5847 * Promise.{race, all}/AsyncFunctionAwait, we pass the parent promise | 5887 * Promise.{race, all}/AsyncFunctionAwait, we pass the parent promise |
5848 * otherwise we pass undefined. | 5888 * otherwise we pass undefined. |
5849 * | 5889 * |
5850 * PromiseHook with type kResolve is called at the beginning of | 5890 * PromiseHook with type kResolve is called at the beginning of |
5851 * resolve or reject function defined by CreateResolvingFunctions. | 5891 * resolve or reject function defined by CreateResolvingFunctions. |
5852 * | 5892 * |
5853 * PromiseHook with type kBefore is called at the beginning of the | 5893 * PromiseHook with type kBefore is called at the beginning of the |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6386 struct CreateParams { | 6426 struct CreateParams { |
6387 CreateParams() | 6427 CreateParams() |
6388 : entry_hook(nullptr), | 6428 : entry_hook(nullptr), |
6389 code_event_handler(nullptr), | 6429 code_event_handler(nullptr), |
6390 snapshot_blob(nullptr), | 6430 snapshot_blob(nullptr), |
6391 counter_lookup_callback(nullptr), | 6431 counter_lookup_callback(nullptr), |
6392 create_histogram_callback(nullptr), | 6432 create_histogram_callback(nullptr), |
6393 add_histogram_sample_callback(nullptr), | 6433 add_histogram_sample_callback(nullptr), |
6394 array_buffer_allocator(nullptr), | 6434 array_buffer_allocator(nullptr), |
6395 external_references(nullptr), | 6435 external_references(nullptr), |
6396 allow_atomics_wait(true) {} | 6436 allow_atomics_wait(true), |
6437 host_import_module_dynamically_callback_(nullptr) {} | |
6397 | 6438 |
6398 /** | 6439 /** |
6399 * The optional entry_hook allows the host application to provide the | 6440 * The optional entry_hook allows the host application to provide the |
6400 * address of a function that's invoked on entry to every V8-generated | 6441 * address of a function that's invoked on entry to every V8-generated |
6401 * function. Note that entry_hook is invoked at the very start of each | 6442 * function. Note that entry_hook is invoked at the very start of each |
6402 * generated function. | 6443 * generated function. |
6403 * An entry_hook can only be provided in no-snapshot builds; in snapshot | 6444 * An entry_hook can only be provided in no-snapshot builds; in snapshot |
6404 * builds it must be nullptr. | 6445 * builds it must be nullptr. |
6405 */ | 6446 */ |
6406 FunctionEntryHook entry_hook; | 6447 FunctionEntryHook entry_hook; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6449 * deserialization. This array and its content must stay valid for the | 6490 * deserialization. This array and its content must stay valid for the |
6450 * entire lifetime of the isolate. | 6491 * entire lifetime of the isolate. |
6451 */ | 6492 */ |
6452 intptr_t* external_references; | 6493 intptr_t* external_references; |
6453 | 6494 |
6454 /** | 6495 /** |
6455 * Whether calling Atomics.wait (a function that may block) is allowed in | 6496 * Whether calling Atomics.wait (a function that may block) is allowed in |
6456 * this isolate. | 6497 * this isolate. |
6457 */ | 6498 */ |
6458 bool allow_atomics_wait; | 6499 bool allow_atomics_wait; |
6500 | |
6501 /** | |
6502 * This is an unfinished experimental feature, and is only exposed | |
6503 * here for internal testing purposes. DO NOT USE. | |
6504 * | |
6505 * This specifies the callback called by the upcoming dynamic | |
6506 * import() language feature to load modules. | |
6507 */ | |
6508 HostImportModuleDynamicallyCallback | |
6509 host_import_module_dynamically_callback_; | |
6459 }; | 6510 }; |
6460 | 6511 |
6461 | 6512 |
6462 /** | 6513 /** |
6463 * Stack-allocated class which sets the isolate for all operations | 6514 * Stack-allocated class which sets the isolate for all operations |
6464 * executed within a local scope. | 6515 * executed within a local scope. |
6465 */ | 6516 */ |
6466 class V8_EXPORT Scope { | 6517 class V8_EXPORT Scope { |
6467 public: | 6518 public: |
6468 explicit Scope(Isolate* isolate) : isolate_(isolate) { | 6519 explicit Scope(Isolate* isolate) : isolate_(isolate) { |
(...skipping 3418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9887 */ | 9938 */ |
9888 | 9939 |
9889 | 9940 |
9890 } // namespace v8 | 9941 } // namespace v8 |
9891 | 9942 |
9892 | 9943 |
9893 #undef TYPE_CHECK | 9944 #undef TYPE_CHECK |
9894 | 9945 |
9895 | 9946 |
9896 #endif // INCLUDE_V8_H_ | 9947 #endif // INCLUDE_V8_H_ |
OLD | NEW |