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

Unified Diff: Source/bindings/v8/custom/V8PromiseCustom.cpp

Issue 177773002: Support Promises instrumentation on backend. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix in printing NULL parent promises Created 6 years, 10 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/V8PromiseCustom.cpp
diff --git a/Source/bindings/v8/custom/V8PromiseCustom.cpp b/Source/bindings/v8/custom/V8PromiseCustom.cpp
index 66e366818b480da0a7bda3739656916d8076b59c..54fcba9a40820992e827a3a3de5d0ddf4a91e110 100644
--- a/Source/bindings/v8/custom/V8PromiseCustom.cpp
+++ b/Source/bindings/v8/custom/V8PromiseCustom.cpp
@@ -390,6 +390,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::updatePromiseState(currentExecutionContext(isolate), promise, V8PromiseCustom::Fulfilled);
aandrey 2014/02/25 12:36:07 move inside V8PromiseCustom::setState
Alexandra Mikhaylova 2014/02/26 14:08:41 It seems that we can't move the instrumentation in
aandrey 2014/02/26 16:17:42 make V8PromiseCustom::setState accept a promise
Alexandra Mikhaylova 2014/02/28 13:52:05 Done.
propagateToDerived(promise, isolate);
}
@@ -398,6 +399,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::updatePromiseState(currentExecutionContext(isolate), promise, V8PromiseCustom::Rejected);
aandrey 2014/02/25 12:36:07 ditto
Alexandra Mikhaylova 2014/02/26 14:08:41 see above
propagateToDerived(promise, isolate);
}
@@ -638,6 +640,12 @@ v8::Local<v8::Object> V8PromiseCustom::createPromise(v8::Handle<v8::Object> crea
setState(internal, Pending, v8::Undefined(isolate), isolate);
promise->SetInternalField(v8DOMWrapperObjectIndex, internal);
+
+ InspectorInstrumentation::addPromise(currentExecutionContext(isolate),
aandrey 2014/02/25 12:36:07 one line
Alexandra Mikhaylova 2014/02/26 14:08:41 Done.
+ promise,
+ v8::Handle<v8::Object>::Cast(v8::Null(isolate)),
aandrey 2014/02/25 12:36:07 v8::Handle<v8::Object>()
Alexandra Mikhaylova 2014/02/26 14:08:41 Done.
+ Pending);
aandrey 2014/02/25 12:36:07 remove Pending, move up before setState()
Alexandra Mikhaylova 2014/02/26 14:08:41 Done.
+
return promise;
}
@@ -707,7 +715,7 @@ void V8PromiseCustom::resolve(v8::Handle<v8::Object> promise, v8::Handle<v8::Val
setReason(promise, valueInternal->GetInternalField(InternalResultIndex), isolate);
} else {
ASSERT(valueState == Pending);
- setState(internal, Following, valuePromise, isolate);
+ setState(internal, Following, valuePromise, isolate); // TODO: how can we track the Following state?
aandrey 2014/02/25 12:36:07 remove todo
Alexandra Mikhaylova 2014/02/26 14:08:41 Done.
addToDerived(valueInternal, promise, v8::Handle<v8::Function>(), v8::Handle<v8::Function>(), isolate);
}
} else {
@@ -735,6 +743,7 @@ v8::Local<v8::Object> V8PromiseCustom::then(v8::Handle<v8::Object> promise, v8::
// the creation of the promise objects only from the Blink Promise
// constructor.
v8::Local<v8::Object> derivedPromise = createPromise(v8::Handle<v8::Object>(), isolate);
+ InspectorInstrumentation::updatePromiseParent(currentExecutionContext(isolate), derivedPromise, promise);
aandrey 2014/02/25 12:36:07 move inside updateDerivedFromPromise()
Alexandra Mikhaylova 2014/02/26 14:08:41 Done.
updateDerivedFromPromise(derivedPromise, onFulfilled, onRejected, promise, isolate);
return derivedPromise;
}

Powered by Google App Engine
This is Rietveld 408576698