| Index: Source/core/page/PageLifecycleNotifier.h
|
| diff --git a/Source/core/page/PageLifecycleNotifier.h b/Source/core/page/PageLifecycleNotifier.h
|
| index 9c28c6731e14b984b42aea76ae3cb3e00dcde310..a9dddbffd03400d5f4d61afeb46dfd7569a33fba 100644
|
| --- a/Source/core/page/PageLifecycleNotifier.h
|
| +++ b/Source/core/page/PageLifecycleNotifier.h
|
| @@ -26,33 +26,52 @@
|
| #ifndef PageLifecycleNotifier_h
|
| #define PageLifecycleNotifier_h
|
|
|
| +#include "core/page/Page.h"
|
| +#include "core/page/PageLifecycleObserver.h"
|
| #include "platform/LifecycleNotifier.h"
|
| -#include "wtf/HashSet.h"
|
| #include "wtf/PassOwnPtr.h"
|
| #include "wtf/TemporaryChange.h"
|
|
|
| namespace blink {
|
|
|
| class LocalFrame;
|
| -class Page;
|
| -class PageLifecycleObserver;
|
|
|
| -class PageLifecycleNotifier : public LifecycleNotifier<Page> {
|
| +class PageLifecycleNotifier final : public LifecycleNotifier<Page> {
|
| public:
|
| + static PassOwnPtr<PageLifecycleNotifier> create(Page*);
|
| +
|
| void notifyPageVisibilityChanged();
|
| void notifyDidCommitLoad(LocalFrame*);
|
|
|
| virtual void addObserver(Observer*) override;
|
| virtual void removeObserver(Observer*) override;
|
|
|
| -protected:
|
| +private:
|
| explicit PageLifecycleNotifier(Page*);
|
|
|
| -private:
|
| using PageObserverSet = HashSet<PageLifecycleObserver*>;
|
| PageObserverSet m_pageObservers;
|
| };
|
|
|
| +inline PassOwnPtr<PageLifecycleNotifier> PageLifecycleNotifier::create(Page* context)
|
| +{
|
| + return adoptPtr(new PageLifecycleNotifier(context));
|
| +}
|
| +
|
| +inline void PageLifecycleNotifier::notifyPageVisibilityChanged()
|
| +{
|
| + TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverPageObservers);
|
| + for (PageLifecycleObserver* pageObserver : m_pageObservers)
|
| + pageObserver->pageVisibilityChanged();
|
| +}
|
| +
|
| +inline void PageLifecycleNotifier::notifyDidCommitLoad(LocalFrame* frame)
|
| +{
|
| + TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverPageObservers);
|
| + for (PageLifecycleObserver* pageObserver : m_pageObservers)
|
| + pageObserver->didCommitLoad(frame);
|
| +}
|
| +
|
| } // namespace blink
|
|
|
| #endif // PageLifecycleNotifier_h
|
|
|