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

Side by Side Diff: include/v8.h

Issue 600723005: Introduce PromiseRejectCallback. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: not omit callback for Promise.reject() Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 class Integer; 78 class Integer;
79 class Isolate; 79 class Isolate;
80 class Name; 80 class Name;
81 class Number; 81 class Number;
82 class NumberObject; 82 class NumberObject;
83 class Object; 83 class Object;
84 class ObjectOperationDescriptor; 84 class ObjectOperationDescriptor;
85 class ObjectTemplate; 85 class ObjectTemplate;
86 class Platform; 86 class Platform;
87 class Primitive; 87 class Primitive;
88 class Promise;
88 class RawOperationDescriptor; 89 class RawOperationDescriptor;
89 class Script; 90 class Script;
90 class Signature; 91 class Signature;
91 class StackFrame; 92 class StackFrame;
92 class StackTrace; 93 class StackTrace;
93 class String; 94 class String;
94 class StringObject; 95 class StringObject;
95 class Symbol; 96 class Symbol;
96 class SymbolObject; 97 class SymbolObject;
97 class Private; 98 class Private;
(...skipping 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2844 /** 2845 /**
2845 * Register a resolution/rejection handler with a promise. 2846 * Register a resolution/rejection handler with a promise.
2846 * The handler is given the respective resolution/rejection value as 2847 * The handler is given the respective resolution/rejection value as
2847 * an argument. If the promise is already resolved/rejected, the handler is 2848 * an argument. If the promise is already resolved/rejected, the handler is
2848 * invoked at the end of turn. 2849 * invoked at the end of turn.
2849 */ 2850 */
2850 Local<Promise> Chain(Handle<Function> handler); 2851 Local<Promise> Chain(Handle<Function> handler);
2851 Local<Promise> Catch(Handle<Function> handler); 2852 Local<Promise> Catch(Handle<Function> handler);
2852 Local<Promise> Then(Handle<Function> handler); 2853 Local<Promise> Then(Handle<Function> handler);
2853 2854
2855 /**
2856 * Returns true if the promise has a reject handler
2857 * (including default handler).
2858 */
2859 bool HasRejectHandler();
yurys 2014/09/30 12:41:46 Would it make sense to rename this method to HasDe
2860
2854 V8_INLINE static Promise* Cast(Value* obj); 2861 V8_INLINE static Promise* Cast(Value* obj);
2855 2862
2856 private: 2863 private:
2857 Promise(); 2864 Promise();
2858 static void CheckCast(Value* obj); 2865 static void CheckCast(Value* obj);
2859 }; 2866 };
2860 2867
2861 2868
2862 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2869 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
2863 // The number of required internal fields can be defined by embedder. 2870 // The number of required internal fields can be defined by embedder.
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
4189 kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFree 4196 kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFree
4190 }; 4197 };
4191 4198
4192 typedef void (*MemoryAllocationCallback)(ObjectSpace space, 4199 typedef void (*MemoryAllocationCallback)(ObjectSpace space,
4193 AllocationAction action, 4200 AllocationAction action,
4194 int size); 4201 int size);
4195 4202
4196 // --- Leave Script Callback --- 4203 // --- Leave Script Callback ---
4197 typedef void (*CallCompletedCallback)(); 4204 typedef void (*CallCompletedCallback)();
4198 4205
4206 // --- Promise Reject Callback ---
4207 enum PromiseRejectEvent {
4208 kPromiseRejectWithNoHandler = 0,
4209 kPromiseHandlerAddedAfterReject = 1
4210 };
4211
4212 typedef void (*PromiseRejectCallback)(Handle<Promise> promise,
4213 Handle<Value> value,
4214 PromiseRejectEvent event);
4215
4199 // --- Microtask Callback --- 4216 // --- Microtask Callback ---
4200 typedef void (*MicrotaskCallback)(void* data); 4217 typedef void (*MicrotaskCallback)(void* data);
4201 4218
4202 // --- Failed Access Check Callback --- 4219 // --- Failed Access Check Callback ---
4203 typedef void (*FailedAccessCheckCallback)(Local<Object> target, 4220 typedef void (*FailedAccessCheckCallback)(Local<Object> target,
4204 AccessType type, 4221 AccessType type,
4205 Local<Value> data); 4222 Local<Value> data);
4206 4223
4207 // --- AllowCodeGenerationFromStrings callbacks --- 4224 // --- AllowCodeGenerationFromStrings callbacks ---
4208 4225
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
4764 * execution ends. Executing scripts inside the callback do not trigger 4781 * execution ends. Executing scripts inside the callback do not trigger
4765 * further callbacks. 4782 * further callbacks.
4766 */ 4783 */
4767 void AddCallCompletedCallback(CallCompletedCallback callback); 4784 void AddCallCompletedCallback(CallCompletedCallback callback);
4768 4785
4769 /** 4786 /**
4770 * Removes callback that was installed by AddCallCompletedCallback. 4787 * Removes callback that was installed by AddCallCompletedCallback.
4771 */ 4788 */
4772 void RemoveCallCompletedCallback(CallCompletedCallback callback); 4789 void RemoveCallCompletedCallback(CallCompletedCallback callback);
4773 4790
4791
4792 /**
4793 * Set callback to notify about promise reject with no handler, or
4794 * revocation of such a previous notification once the handler is added.
4795 */
4796 void SetPromiseRejectCallback(PromiseRejectCallback callback);
4797
4774 /** 4798 /**
4775 * Experimental: Runs the Microtask Work Queue until empty 4799 * Experimental: Runs the Microtask Work Queue until empty
4776 * Any exceptions thrown by microtask callbacks are swallowed. 4800 * Any exceptions thrown by microtask callbacks are swallowed.
4777 */ 4801 */
4778 void RunMicrotasks(); 4802 void RunMicrotasks();
4779 4803
4780 /** 4804 /**
4781 * Experimental: Enqueues the callback to the Microtask Work Queue 4805 * Experimental: Enqueues the callback to the Microtask Work Queue
4782 */ 4806 */
4783 void EnqueueMicrotask(Handle<Function> microtask); 4807 void EnqueueMicrotask(Handle<Function> microtask);
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
5873 4 * kApiPointerSize; 5897 4 * kApiPointerSize;
5874 static const int kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset = 5898 static const int kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset =
5875 kAmountOfExternalAllocatedMemoryOffset + kApiInt64Size; 5899 kAmountOfExternalAllocatedMemoryOffset + kApiInt64Size;
5876 static const int kIsolateRootsOffset = 5900 static const int kIsolateRootsOffset =
5877 kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset + kApiInt64Size + 5901 kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset + kApiInt64Size +
5878 kApiPointerSize; 5902 kApiPointerSize;
5879 static const int kUndefinedValueRootIndex = 5; 5903 static const int kUndefinedValueRootIndex = 5;
5880 static const int kNullValueRootIndex = 7; 5904 static const int kNullValueRootIndex = 7;
5881 static const int kTrueValueRootIndex = 8; 5905 static const int kTrueValueRootIndex = 8;
5882 static const int kFalseValueRootIndex = 9; 5906 static const int kFalseValueRootIndex = 9;
5883 static const int kEmptyStringRootIndex = 164; 5907 static const int kEmptyStringRootIndex = 166;
5884 5908
5885 // The external allocation limit should be below 256 MB on all architectures 5909 // The external allocation limit should be below 256 MB on all architectures
5886 // to avoid that resource-constrained embedders run low on memory. 5910 // to avoid that resource-constrained embedders run low on memory.
5887 static const int kExternalAllocationLimit = 192 * 1024 * 1024; 5911 static const int kExternalAllocationLimit = 192 * 1024 * 1024;
5888 5912
5889 static const int kNodeClassIdOffset = 1 * kApiPointerSize; 5913 static const int kNodeClassIdOffset = 1 * kApiPointerSize;
5890 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; 5914 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
5891 static const int kNodeStateMask = 0xf; 5915 static const int kNodeStateMask = 0xf;
5892 static const int kNodeStateIsWeakValue = 2; 5916 static const int kNodeStateIsWeakValue = 2;
5893 static const int kNodeStateIsPendingValue = 3; 5917 static const int kNodeStateIsPendingValue = 3;
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
7009 */ 7033 */
7010 7034
7011 7035
7012 } // namespace v8 7036 } // namespace v8
7013 7037
7014 7038
7015 #undef TYPE_CHECK 7039 #undef TYPE_CHECK
7016 7040
7017 7041
7018 #endif // V8_H_ 7042 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698