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

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..829c1c0cc3bd92784cb35a71907eb64849b8e5d9 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 {
+ContextClient::ContextClient(LocalFrame* frame)
+ : m_executionContext(frame ? frame->document() : nullptr) {}
+
+ExecutionContext* ContextClient::getExecutionContext() const {
+ return m_executionContext && !m_executionContext->isContextDestroyed()
+ ? m_executionContext
+ : nullptr;
+}
+
+LocalFrame* ContextClient::frame() const {
+ return m_executionContext && m_executionContext->isDocument()
+ ? toDocument(m_executionContext)->frame()
+ : nullptr;
+}
+
+DEFINE_TRACE(ContextClient) {
+ visitor->trace(m_executionContext);
+}
+
LocalFrame* ContextLifecycleObserver::frame() const {
return getExecutionContext() && getExecutionContext()->isDocument()
? toDocument(getExecutionContext())->frame()
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h ('k') | third_party/WebKit/Source/core/frame/BarProp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698