Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h |
| diff --git a/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h b/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h |
| index a2fddd3a8a0a455b98b1fea132826f8ded0d4213..5010b9303ee222162606f332e8c3da356ae825e5 100644 |
| --- a/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h |
| +++ b/third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h |
| @@ -35,6 +35,31 @@ namespace blink { |
| class LocalFrame; |
| +// ContextObserver is a lightweight version of ContextLifecycleObserver. |
| +// If you just want to use getExecutionContext() and frame(), use |
| +// ContextObserver. If you need to listen contextDestroyed() notifications, |
| +// use ContextLifecycleObserver. |
| +class CORE_EXPORT ContextObserver : public GarbageCollectedMixin { |
| + public: |
| + // Returns null after the observing context is detached. |
| + ExecutionContext* getExecutionContext() const; |
| + |
| + // Returns null after the observing context is detached or if the context |
| + // doesn't have a frame (i.e., if the context is not a Document). |
| + LocalFrame* frame() const; |
| + |
| + DECLARE_VIRTUAL_TRACE(); |
| + |
| + protected: |
| + explicit ContextObserver(ExecutionContext* executionContext) |
| + : m_executionContext(executionContext) {} |
| + |
| + explicit ContextObserver(LocalFrame*); |
| + |
| + private: |
| + WeakMember<ExecutionContext> m_executionContext; |
|
sof
2016/12/19 09:14:03
For clarity, what motivates the weakness?
haraken
2016/12/19 09:58:15
For example, this CL (https://codereview.chromium.
|
| +}; |
| + |
| class CORE_EXPORT ContextLifecycleObserver |
| : public LifecycleObserver<ExecutionContext, ContextLifecycleObserver> { |
| public: |