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

Unified Diff: Source/core/page/PageLifecycleNotifier.h

Issue 901663005: Revert r189385 "Remove LifecycleContext" and r189391, r189530, r189456 that block it (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months 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 | « Source/core/page/Page.cpp ('k') | Source/core/page/PageLifecycleNotifier.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/page/Page.cpp ('k') | Source/core/page/PageLifecycleNotifier.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698