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 5738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5749 kAllocationActionAllocate = 1 << 0, | 5749 kAllocationActionAllocate = 1 << 0, |
5750 kAllocationActionFree = 1 << 1, | 5750 kAllocationActionFree = 1 << 1, |
5751 kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFree | 5751 kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFree |
5752 }; | 5752 }; |
5753 | 5753 |
5754 // --- Enter/Leave Script Callback --- | 5754 // --- Enter/Leave Script Callback --- |
5755 typedef void (*BeforeCallEnteredCallback)(Isolate*); | 5755 typedef void (*BeforeCallEnteredCallback)(Isolate*); |
5756 typedef void (*CallCompletedCallback)(Isolate*); | 5756 typedef void (*CallCompletedCallback)(Isolate*); |
5757 typedef void (*DeprecatedCallCompletedCallback)(); | 5757 typedef void (*DeprecatedCallCompletedCallback)(); |
5758 | 5758 |
| 5759 /** |
| 5760 * PromiseHook with type kInit is called when a new promise is |
| 5761 * created. When a new promise is created as part of the chain in the |
| 5762 * case of Promise.then or in the intermediate promises created by |
| 5763 * Promise.{race, all}/AsyncFunctionAwait, we pass the parent promise |
| 5764 * otherwise we pass undefined. |
| 5765 * |
| 5766 * PromiseHook with type kResolve is called at the beginning of |
| 5767 * resolve or reject function defined by CreateResolvingFunctions. |
| 5768 * |
| 5769 * PromiseHook with type kBefore is called at the beginning of the |
| 5770 * PromiseReactionJob. |
| 5771 * |
| 5772 * PromiseHook with type kAfter is called right at the end of the |
| 5773 * PromiseReactionJob. |
| 5774 */ |
| 5775 enum class PromiseHookType { kInit, kResolve, kBefore, kAfter }; |
| 5776 |
| 5777 typedef void (*PromiseHook)(PromiseHookType type, Local<Promise> promise, |
| 5778 Local<Value> parent); |
| 5779 |
5759 // --- Promise Reject Callback --- | 5780 // --- Promise Reject Callback --- |
5760 enum PromiseRejectEvent { | 5781 enum PromiseRejectEvent { |
5761 kPromiseRejectWithNoHandler = 0, | 5782 kPromiseRejectWithNoHandler = 0, |
5762 kPromiseHandlerAddedAfterReject = 1 | 5783 kPromiseHandlerAddedAfterReject = 1 |
5763 }; | 5784 }; |
5764 | 5785 |
5765 class PromiseRejectMessage { | 5786 class PromiseRejectMessage { |
5766 public: | 5787 public: |
5767 PromiseRejectMessage(Local<Promise> promise, PromiseRejectEvent event, | 5788 PromiseRejectMessage(Local<Promise> promise, PromiseRejectEvent event, |
5768 Local<Value> value, Local<StackTrace> stack_trace) | 5789 Local<Value> value, Local<StackTrace> stack_trace) |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6860 /** | 6881 /** |
6861 * Removes callback that was installed by AddCallCompletedCallback. | 6882 * Removes callback that was installed by AddCallCompletedCallback. |
6862 */ | 6883 */ |
6863 void RemoveCallCompletedCallback(CallCompletedCallback callback); | 6884 void RemoveCallCompletedCallback(CallCompletedCallback callback); |
6864 V8_DEPRECATE_SOON( | 6885 V8_DEPRECATE_SOON( |
6865 "Use callback with parameter", | 6886 "Use callback with parameter", |
6866 void RemoveCallCompletedCallback( | 6887 void RemoveCallCompletedCallback( |
6867 DeprecatedCallCompletedCallback callback)); | 6888 DeprecatedCallCompletedCallback callback)); |
6868 | 6889 |
6869 /** | 6890 /** |
| 6891 * Experimental: Set the PromiseHook callback for various promise |
| 6892 * lifecycle events. |
| 6893 */ |
| 6894 void SetPromiseHook(PromiseHook hook); |
| 6895 |
| 6896 /** |
6870 * Set callback to notify about promise reject with no handler, or | 6897 * Set callback to notify about promise reject with no handler, or |
6871 * revocation of such a previous notification once the handler is added. | 6898 * revocation of such a previous notification once the handler is added. |
6872 */ | 6899 */ |
6873 void SetPromiseRejectCallback(PromiseRejectCallback callback); | 6900 void SetPromiseRejectCallback(PromiseRejectCallback callback); |
6874 | 6901 |
6875 /** | 6902 /** |
6876 * Experimental: Runs the Microtask Work Queue until empty | 6903 * Experimental: Runs the Microtask Work Queue until empty |
6877 * Any exceptions thrown by microtask callbacks are swallowed. | 6904 * Any exceptions thrown by microtask callbacks are swallowed. |
6878 */ | 6905 */ |
6879 void RunMicrotasks(); | 6906 void RunMicrotasks(); |
(...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9704 */ | 9731 */ |
9705 | 9732 |
9706 | 9733 |
9707 } // namespace v8 | 9734 } // namespace v8 |
9708 | 9735 |
9709 | 9736 |
9710 #undef TYPE_CHECK | 9737 #undef TYPE_CHECK |
9711 | 9738 |
9712 | 9739 |
9713 #endif // INCLUDE_V8_H_ | 9740 #endif // INCLUDE_V8_H_ |
OLD | NEW |