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

Unified Diff: third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp

Issue 2585143002: Introduce ContextObserver (Closed)
Patch Set: temp 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
Index: third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp
diff --git a/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp b/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp
index 24fcf42d9f4b506da5f42dddf9ec8a94d279ff71..69af15230e33d59b4070c849d7d87bad6966edcf 100644
--- a/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp
+++ b/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp
@@ -9,6 +9,25 @@
namespace blink {
+ContextObserver::ContextObserver(LocalFrame* frame)
+ : m_executionContext(frame ? frame->document() : nullptr) {}
sof 2016/12/19 09:14:03 Can BarProp be changed to be over Document* instea
haraken 2016/12/19 09:58:15 I can, but as far as I grep the code base, there a
+
+ExecutionContext* ContextObserver::getExecutionContext() const {
+ return m_executionContext && !m_executionContext->isContextDestroyed()
+ ? m_executionContext
+ : nullptr;
+}
+
+LocalFrame* ContextObserver::frame() const {
+ return m_executionContext && m_executionContext->isDocument()
+ ? toDocument(m_executionContext)->frame()
+ : nullptr;
+}
+
+DEFINE_TRACE(ContextObserver) {
+ visitor->trace(m_executionContext);
+}
+
LocalFrame* ContextLifecycleObserver::frame() const {
return getExecutionContext() && getExecutionContext()->isDocument()
? toDocument(getExecutionContext())->frame()

Powered by Google App Engine
This is Rietveld 408576698