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: Source/bindings/v8/custom/V8PromiseResolverCustom.cpp

Issue 17993004: Implement PromiseResolver.prototype.{fulfill, reject} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 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
Index: Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
diff --git a/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp b/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
index b2a364c7add90350ee416981f9db836e7b3d2cd4..941e49062b3f08e8fe11ad070032f597f640a17c 100644
--- a/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
+++ b/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
@@ -31,7 +31,34 @@
#include "config.h"
#include "V8PromiseResolver.h"
+#include "bindings/v8/V8Binding.h"
+#include "bindings/v8/custom/V8PromiseCustom.h"
#include <v8.h>
namespace WebCore {
+
+void V8PromiseResolver::fulfillMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::Local<v8::Value> result = v8::Undefined();
haraken 2013/06/27 06:55:56 You don't need to set v8::Undefined().
yhirano 2013/06/27 09:29:23 Done.
+ if (args.Length() > 0 && !args[0].IsEmpty())
haraken 2013/06/27 06:55:56 Do you need to check !args[0].IsEmpty()? Normally
yhirano 2013/06/27 09:29:23 Done.
+ result = args[0];
+ v8::Local<v8::Object> resolver = args.Holder();
+ ASSERT(!resolver.IsEmpty());
+ v8SetReturnValue(args, v8::Undefined());
haraken 2013/06/27 06:55:56 Remove this. v8::Undefined() is set by default.
yhirano 2013/06/27 09:29:23 Done.
+ V8PromiseCustom::fulfillResolver(resolver, result, V8PromiseCustom::Asynchronous, isolate);
+}
+
+void V8PromiseResolver::rejectMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::Local<v8::Value> result = v8::Undefined();
haraken 2013/06/27 06:55:56 Ditto.
yhirano 2013/06/27 09:29:23 Done.
+ if (args.Length() > 0 && !args[0].IsEmpty())
haraken 2013/06/27 06:55:56 Ditto.
yhirano 2013/06/27 09:29:23 Done.
+ result = args[0];
+ v8::Local<v8::Object> resolver = args.Holder();
+ ASSERT(!resolver.IsEmpty());
+ v8SetReturnValue(args, v8::Undefined());
haraken 2013/06/27 06:55:56 Ditto.
yhirano 2013/06/27 09:29:23 Done.
+ V8PromiseCustom::rejectResolver(resolver, result, V8PromiseCustom::Asynchronous, isolate);
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698