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

Unified Diff: include/v8.h

Issue 600723005: Introduce PromiseRejectCallback. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | « no previous file | src/api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 4d5d7138043954bb598c7ad4b5319c6d27c38a15..c9b3862be5027216830f95536cfade85d77b1f7e 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -85,6 +85,7 @@ class ObjectOperationDescriptor;
class ObjectTemplate;
class Platform;
class Primitive;
+class Promise;
class RawOperationDescriptor;
class Script;
class Signature;
@@ -2851,6 +2852,12 @@ class V8_EXPORT Promise : public Object {
Local<Promise> Catch(Handle<Function> handler);
Local<Promise> Then(Handle<Function> handler);
+ /**
+ * Returns true if the promise has at least one derived promise, and
+ * therefore resolve/reject handlers (including default handler).
+ */
+ bool HasHandler();
+
V8_INLINE static Promise* Cast(Value* obj);
private:
@@ -4196,6 +4203,16 @@ typedef void (*MemoryAllocationCallback)(ObjectSpace space,
// --- Leave Script Callback ---
typedef void (*CallCompletedCallback)();
+// --- Promise Reject Callback ---
+enum PromiseRejectEvent {
+ kPromiseRejectWithNoHandler = 0,
+ kPromiseHandlerAddedAfterReject = 1
+};
+
+typedef void (*PromiseRejectCallback)(Handle<Promise> promise,
yurys 2014/10/01 12:41:18 I've just realized that it may be convenient to al
Sven Panne 2014/10/01 12:49:30 [ Sven's Isolate::GetCurrent() alarm bells ringing
+ Handle<Value> value,
+ PromiseRejectEvent event);
+
// --- Microtask Callback ---
typedef void (*MicrotaskCallback)(void* data);
@@ -4771,6 +4788,13 @@ class V8_EXPORT Isolate {
*/
void RemoveCallCompletedCallback(CallCompletedCallback callback);
+
+ /**
+ * Set callback to notify about promise reject with no handler, or
+ * revocation of such a previous notification once the handler is added.
+ */
+ void SetPromiseRejectCallback(PromiseRejectCallback callback);
+
/**
* Experimental: Runs the Microtask Work Queue until empty
* Any exceptions thrown by microtask callbacks are swallowed.
@@ -5880,7 +5904,7 @@ class Internals {
static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8;
static const int kFalseValueRootIndex = 9;
- static const int kEmptyStringRootIndex = 164;
+ static const int kEmptyStringRootIndex = 166;
// The external allocation limit should be below 256 MB on all architectures
// to avoid that resource-constrained embedders run low on memory.
« 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