Chromium Code Reviews| Index: Source/bindings/v8/custom/V8PromiseCustom.cpp |
| diff --git a/Source/bindings/v8/custom/V8PromiseCustom.cpp b/Source/bindings/v8/custom/V8PromiseCustom.cpp |
| index 66e366818b480da0a7bda3739656916d8076b59c..568acc9957ae5f87a3ca3489a7b01a0838d886d6 100644 |
| --- a/Source/bindings/v8/custom/V8PromiseCustom.cpp |
| +++ b/Source/bindings/v8/custom/V8PromiseCustom.cpp |
| @@ -45,6 +45,7 @@ |
| #include "core/dom/ExecutionContextTask.h" |
| #include "core/frame/DOMWindow.h" |
| #include "core/inspector/InspectorInstrumentation.h" |
|
aandrey
2014/02/26 16:11:30
remove
Alexandra Mikhaylova
2014/02/28 13:52:05
Done.
|
| +#include "core/inspector/InspectorPromiseInstrumentation.h" |
| #include "core/workers/WorkerGlobalScope.h" |
| #include "platform/Task.h" |
| #include "wtf/Deque.h" |
| @@ -390,6 +391,7 @@ void PromisePropagator::setValue(v8::Handle<v8::Object> promise, v8::Handle<v8:: |
| v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(promise); |
| ASSERT(V8PromiseCustom::getState(internal) != V8PromiseCustom::Fulfilled && V8PromiseCustom::getState(internal) != V8PromiseCustom::Rejected); |
| V8PromiseCustom::setState(internal, V8PromiseCustom::Fulfilled, value, isolate); |
| + InspectorInstrumentation::setPromiseStateAndResult(currentExecutionContext(isolate), promise, value, V8PromiseCustom::Fulfilled); |
|
aandrey
2014/02/26 16:11:30
move inside setState
Alexandra Mikhaylova
2014/02/28 13:52:05
Done.
|
| propagateToDerived(promise, isolate); |
| } |
| @@ -398,6 +400,7 @@ void PromisePropagator::setReason(v8::Handle<v8::Object> promise, v8::Handle<v8: |
| v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(promise); |
| ASSERT(V8PromiseCustom::getState(internal) != V8PromiseCustom::Fulfilled && V8PromiseCustom::getState(internal) != V8PromiseCustom::Rejected); |
| V8PromiseCustom::setState(internal, V8PromiseCustom::Rejected, reason, isolate); |
| + InspectorInstrumentation::setPromiseStateAndResult(currentExecutionContext(isolate), promise, reason, V8PromiseCustom::Rejected); |
|
aandrey
2014/02/26 16:11:30
ditto
Alexandra Mikhaylova
2014/02/28 13:52:05
Done.
|
| propagateToDerived(promise, isolate); |
| } |
| @@ -471,6 +474,7 @@ void PromisePropagator::updateDerived(v8::Handle<v8::Object> derivedPromise, v8: |
| void PromisePropagator::updateDerivedFromPromise(v8::Handle<v8::Object> derivedPromise, v8::Handle<v8::Function> onFulfilled, v8::Handle<v8::Function> onRejected, v8::Handle<v8::Object> promise, v8::Isolate* isolate) |
| { |
| + InspectorInstrumentation::setPromiseParent(currentExecutionContext(isolate), derivedPromise, promise); |
| v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(promise); |
| V8PromiseCustom::PromiseState state = V8PromiseCustom::getState(internal); |
| if (state == V8PromiseCustom::Fulfilled || state == V8PromiseCustom::Rejected) { |
| @@ -635,9 +639,14 @@ v8::Local<v8::Object> V8PromiseCustom::createPromise(v8::Handle<v8::Object> crea |
| v8::Local<v8::Object> promise = V8DOMWrapper::createWrapper(creationContext, &V8Promise::wrapperTypeInfo, 0, isolate); |
| clearDerived(internal, isolate); |
| + |
| + InspectorInstrumentation::addPromise(currentExecutionContext(isolate), promise, v8::Handle<v8::Object>()); |
| + |
| setState(internal, Pending, v8::Undefined(isolate), isolate); |
| + InspectorInstrumentation::setPromiseStateAndResult(currentExecutionContext(isolate), promise, v8::Undefined(isolate), Pending); |
|
aandrey
2014/02/26 16:11:30
remove
Alexandra Mikhaylova
2014/02/28 13:52:05
Done.
|
| promise->SetInternalField(v8DOMWrapperObjectIndex, internal); |
| + |
|
aandrey
2014/02/26 16:11:30
revert
Alexandra Mikhaylova
2014/02/28 13:52:05
Done.
|
| return promise; |
| } |
| @@ -700,6 +709,7 @@ void V8PromiseCustom::resolve(v8::Handle<v8::Object> promise, v8::Handle<v8::Val |
| } else if (valueState == Following) { |
| v8::Local<v8::Object> valuePromiseFollowing = valueInternal->GetInternalField(InternalResultIndex).As<v8::Object>(); |
| setState(internal, Following, valuePromiseFollowing, isolate); |
| + InspectorInstrumentation::setPromiseStateAndResult(currentExecutionContext(isolate), promise, valuePromiseFollowing, Following); |
|
aandrey
2014/02/26 16:11:30
move inside setState
Alexandra Mikhaylova
2014/02/28 13:52:05
Done.
|
| addToDerived(getInternal(valuePromiseFollowing), promise, v8::Handle<v8::Function>(), v8::Handle<v8::Function>(), isolate); |
| } else if (valueState == Fulfilled) { |
| setValue(promise, valueInternal->GetInternalField(InternalResultIndex), isolate); |
| @@ -708,6 +718,7 @@ void V8PromiseCustom::resolve(v8::Handle<v8::Object> promise, v8::Handle<v8::Val |
| } else { |
| ASSERT(valueState == Pending); |
| setState(internal, Following, valuePromise, isolate); |
| + InspectorInstrumentation::setPromiseStateAndResult(currentExecutionContext(isolate), promise, valuePromise, Following); |
|
aandrey
2014/02/26 16:11:30
move inside setState
Alexandra Mikhaylova
2014/02/28 13:52:05
Done.
|
| addToDerived(valueInternal, promise, v8::Handle<v8::Function>(), v8::Handle<v8::Function>(), isolate); |
| } |
| } else { |