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

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

Issue 2555873004: 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 e1c0ab831088fbdfeb86b3894cef87a4acac8f0c..ebfd503fb2359507a30a026c3760f14cd92bfd4f 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 @@ namespace blink {
ScriptPromisePropertyBase::ScriptPromisePropertyBase(
ExecutionContext* executionContext,
Name name)
- : ContextLifecycleObserver(executionContext),
+ : m_executionContext(executionContext),
m_isolate(toIsolate(executionContext)),
m_name(name),
m_state(Pending) {}
@@ -26,19 +26,23 @@ ScriptPromisePropertyBase::~ScriptPromisePropertyBase() {
clearWrappers();
}
+ExecutionContext* ScriptPromisePropertyBase::getExecutionContext() const {
+ return m_executionContext;
+}
+
ScriptPromise ScriptPromisePropertyBase::promise(DOMWrapperWorld& world) {
- if (!getExecutionContext())
+ if (m_executionContext->isContextDestroyed())
return ScriptPromise();
v8::HandleScope handleScope(m_isolate);
- v8::Local<v8::Context> context = toV8Context(getExecutionContext(), world);
+ v8::Local<v8::Context> context = toV8Context(m_executionContext, world);
if (context.IsEmpty())
return ScriptPromise();
ScriptState* scriptState = ScriptState::from(context);
ScriptState::Scope scope(scriptState);
v8::Local<v8::Object> wrapper = ensureHolderWrapper(scriptState);
- ASSERT(wrapper->CreationContext() == context);
+ DCHECK(wrapper->CreationContext() == context);
v8::Local<v8::Value> cachedPromise =
V8HiddenValue::getHiddenValue(scriptState, wrapper, promiseName());
@@ -68,9 +72,9 @@ ScriptPromise ScriptPromisePropertyBase::promise(DOMWrapperWorld& world) {
}
void ScriptPromisePropertyBase::resolveOrReject(State targetState) {
- ASSERT(getExecutionContext());
- ASSERT(m_state == Pending);
- ASSERT(targetState == Resolved || targetState == Rejected);
+ DCHECK(!m_executionContext->isContextDestroyed());
+ DCHECK(m_state == Pending);
+ DCHECK(targetState == Resolved || targetState == Rejected);
m_state = targetState;
@@ -207,7 +211,7 @@ v8::Local<v8::String> ScriptPromisePropertyBase::resolverName() {
}
DEFINE_TRACE(ScriptPromisePropertyBase) {
- ContextLifecycleObserver::trace(visitor);
+ visitor->trace(m_executionContext);
}
} // 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