| Index: Source/bindings/v8/custom/V8PromiseCustom.h
|
| diff --git a/Source/bindings/v8/custom/V8PromiseCustom.h b/Source/bindings/v8/custom/V8PromiseCustom.h
|
| index 47b64a45ee42e9367b979e579008b06193acb5ec..fe7df653f4817ab82e5579229b4679286702a1fd 100644
|
| --- a/Source/bindings/v8/custom/V8PromiseCustom.h
|
| +++ b/Source/bindings/v8/custom/V8PromiseCustom.h
|
| @@ -39,11 +39,60 @@ public:
|
| InternalFieldCount, // This entry must always be at the bottom.
|
| };
|
|
|
| - enum PromiseStatus {
|
| + enum WrapperCallbackEnvironmentFieldIndex {
|
| + WrapperCallbackEnvironmentPromiseIndex,
|
| + WrapperCallbackEnvironmentPromiseResolverIndex,
|
| + WrapperCallbackEnvironmentCallbackIndex,
|
| + WrapperCallbackEnvironmentFieldCount, // This entry must always be at the bottom.
|
| + };
|
| +
|
| + enum PromiseAlgorithm {
|
| + FulfillAlgorithm,
|
| + ResolveAlgorithm,
|
| + RejectAlgorithm,
|
| + };
|
| +
|
| + enum PromiseState {
|
| Pending,
|
| Fulfilled,
|
| Rejected,
|
| };
|
| +
|
| + enum SynchronousMode {
|
| + Synchronous,
|
| + Asynchronous,
|
| + };
|
| +
|
| + // Create Promise and PromiseResolver instances and set them to |promise| and |resolver| respectively.
|
| + static void createPromise(v8::Handle<v8::Object> creationContext, v8::Local<v8::Object>* promise, v8::Local<v8::Object>* resolver, v8::Isolate*);
|
| +
|
| + // |resolver| must be a PromiseResolver instance.
|
| + static void fulfillResolver(v8::Handle<v8::Object> resolver, v8::Handle<v8::Value> result, SynchronousMode, v8::Isolate*);
|
| + // |resolver| must be a PromiseResolver instance.
|
| + static void resolveResolver(v8::Handle<v8::Object> resolver, v8::Handle<v8::Value> result, SynchronousMode, v8::Isolate*);
|
| + // |resolver| must be a PromiseResolver instance.
|
| + static void rejectResolver(v8::Handle<v8::Object> resolver, v8::Handle<v8::Value> result, SynchronousMode, v8::Isolate*);
|
| +
|
| + // |promise| must be a Promise instance.
|
| + // |fulfillCallback| and |rejectCallback| can be an empty function respectively.
|
| + static void append(v8::Handle<v8::Object> promise, v8::Handle<v8::Function> fulfillCallback, v8::Handle<v8::Function> rejectCallback, v8::Isolate*);
|
| +
|
| + // This function can take either Promise or PromiseResolver objects.
|
| + // If the internal object of a PromiseResolver was set to null, this function returns an empty object.
|
| + static v8::Local<v8::Object> getInternal(v8::Handle<v8::Object> promiseOrPromiseResolver);
|
| +
|
| + // Clear the Promise / PromiseResolver internal object with the given state and result.
|
| + // This function clears callbacks in the object.
|
| + static void clearInternal(v8::Handle<v8::Object> internal, PromiseState, v8::Handle<v8::Value> result);
|
| +
|
| + // |internal| must be an Promise / PromiseResolver internal object.
|
| + static PromiseState getState(v8::Handle<v8::Object> internal);
|
| + // |internal| must be an Promise / PromiseResolver internal object.
|
| + static void setState(v8::Handle<v8::Object> internal, PromiseState);
|
| +
|
| + // Call |function| synchronously or asynchronously, depending on |mode|.
|
| + // If |function| throws an exception, this function catches it and does not rethrow.
|
| + static void call(v8::Handle<v8::Function> /* function */, v8::Handle<v8::Object> receiver, v8::Handle<v8::Value> result, SynchronousMode /* mode */, v8::Isolate*);
|
| };
|
|
|
| } // namespace WebCore
|
|
|