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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp

Issue 2557793004: Revert of Remove ContextLifecycleObserver from ScriptPromisePropertyBase (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
index ebfd503fb2359507a30a026c3760f14cd92bfd4f..e1c0ab831088fbdfeb86b3894cef87a4acac8f0c 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
@@ -17,7 +17,7 @@
ScriptPromisePropertyBase::ScriptPromisePropertyBase(
ExecutionContext* executionContext,
Name name)
- : m_executionContext(executionContext),
+ : ContextLifecycleObserver(executionContext),
m_isolate(toIsolate(executionContext)),
m_name(name),
m_state(Pending) {}
@@ -26,23 +26,19 @@
clearWrappers();
}
-ExecutionContext* ScriptPromisePropertyBase::getExecutionContext() const {
- return m_executionContext;
-}
-
ScriptPromise ScriptPromisePropertyBase::promise(DOMWrapperWorld& world) {
- if (m_executionContext->isContextDestroyed())
+ if (!getExecutionContext())
return ScriptPromise();
v8::HandleScope handleScope(m_isolate);
- v8::Local<v8::Context> context = toV8Context(m_executionContext, world);
+ v8::Local<v8::Context> context = toV8Context(getExecutionContext(), world);
if (context.IsEmpty())
return ScriptPromise();
ScriptState* scriptState = ScriptState::from(context);
ScriptState::Scope scope(scriptState);
v8::Local<v8::Object> wrapper = ensureHolderWrapper(scriptState);
- DCHECK(wrapper->CreationContext() == context);
+ ASSERT(wrapper->CreationContext() == context);
v8::Local<v8::Value> cachedPromise =
V8HiddenValue::getHiddenValue(scriptState, wrapper, promiseName());
@@ -72,9 +68,9 @@
}
void ScriptPromisePropertyBase::resolveOrReject(State targetState) {
- DCHECK(!m_executionContext->isContextDestroyed());
- DCHECK(m_state == Pending);
- DCHECK(targetState == Resolved || targetState == Rejected);
+ ASSERT(getExecutionContext());
+ ASSERT(m_state == Pending);
+ ASSERT(targetState == Resolved || targetState == Rejected);
m_state = targetState;
@@ -211,7 +207,7 @@
}
DEFINE_TRACE(ScriptPromisePropertyBase) {
- visitor->trace(m_executionContext);
+ ContextLifecycleObserver::trace(visitor);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698