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

Unified Diff: Source/bindings/v8/ScriptPromise.cpp

Issue 26004002: Decouple ScriptPromise creation from ScriptPromiseResolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/ScriptPromise.cpp
diff --git a/Source/bindings/v8/custom/V8ErrorEventCustom.cpp b/Source/bindings/v8/ScriptPromise.cpp
similarity index 69%
copy from Source/bindings/v8/custom/V8ErrorEventCustom.cpp
copy to Source/bindings/v8/ScriptPromise.cpp
index b574a22cc08f69ee15fa4a07aa4c9142ac5dc49a..4b532453a4c296e0b7885adfd6984454f4845e9d 100644
--- a/Source/bindings/v8/custom/V8ErrorEventCustom.cpp
+++ b/Source/bindings/v8/ScriptPromise.cpp
@@ -29,31 +29,31 @@
*/
#include "config.h"
-#include "V8ErrorEvent.h"
+#include "bindings/v8/ScriptPromise.h"
-#include "RuntimeEnabledFeatures.h"
-#include "V8Event.h"
-#include "bindings/v8/DOMWrapperWorld.h"
-#include "bindings/v8/Dictionary.h"
-#include "bindings/v8/ScriptState.h"
-#include "bindings/v8/SerializedScriptValue.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8DOMWrapper.h"
-#include "bindings/v8/V8HiddenPropertyName.h"
-#include "core/dom/ContextFeatures.h"
+#include "bindings/v8/custom/V8PromiseCustom.h"
+
+#include <v8.h>
namespace WebCore {
-void V8ErrorEvent::errorAttributeGetterCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
+ScriptPromise ScriptPromise::createPending(ExecutionContext* context)
{
- v8::Handle<v8::Value> error = info.Holder()->GetHiddenValue(V8HiddenPropertyName::error(info.GetIsolate()));
-
- if (!error.IsEmpty()) {
- v8SetReturnValue(info, error);
- return;
- }
+ ASSERT(v8::Context::InContext());
+ ASSERT(context);
+ v8::Isolate* isolate = toIsolate(context);
+ v8::Handle<v8::Object> promise = V8PromiseCustom::createPromise(toV8Context(context, DOMWrapperWorld::current())->Global(), isolate);
+ return ScriptPromise(promise, isolate);
+}
- v8SetReturnValueNull(info);
+ScriptPromise ScriptPromise::createPending()
+{
+ ASSERT(v8::Context::InContext());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::Handle<v8::Object> promise = V8PromiseCustom::createPromise(v8::Object::New(), isolate);
+ return ScriptPromise(promise, isolate);
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698