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

Side by Side Diff: Source/core/frame/PlatformEventController.h

Issue 618673002: Oilpan: reliably track listening PlatformEventControllers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Don't start updating in a stopped context Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PlatformEventController_h 5 #ifndef PlatformEventController_h
6 #define PlatformEventController_h 6 #define PlatformEventController_h
7 7
8 #include "core/page/PageLifecycleObserver.h" 8 #include "core/page/PageLifecycleObserver.h"
9 #include "platform/Timer.h" 9 #include "platform/Timer.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 // Base controller class for registering controllers with a dispatcher. 14 // Base controller class for registering controllers with a dispatcher.
15 // It watches page visibility and calls stopUpdating when page is not visible. 15 // It watches page visibility and calls stopUpdating when page is not visible.
16 // It provides a didUpdateData() callback method which is called when new data 16 // It provides a didUpdateData() callback method which is called when new data
17 // it available. 17 // it available.
18 class PlatformEventController : public PageLifecycleObserver { 18 class PlatformEventController : public WillBeGarbageCollectedMixin, public PageL ifecycleObserver {
19 public: 19 public:
20 void startUpdating(); 20 void startUpdating();
21 void stopUpdating(); 21 void stopUpdating();
22 22
23 // This is called when new data becomes available. 23 // This is called when new data becomes available.
24 virtual void didUpdateData() = 0; 24 virtual void didUpdateData() = 0;
25 25
26 virtual void trace(Visitor*) { }
27
26 protected: 28 protected:
27 explicit PlatformEventController(Page*); 29 explicit PlatformEventController(Page*);
28 virtual ~PlatformEventController(); 30 virtual ~PlatformEventController();
29 31
30 virtual void registerWithDispatcher() = 0; 32 virtual void registerWithDispatcher() = 0;
31 virtual void unregisterWithDispatcher() = 0; 33 virtual void unregisterWithDispatcher() = 0;
32 34
33 // When true initiates a one-shot didUpdateData() when startUpdating() is ca lled. 35 // When true initiates a one-shot didUpdateData() when startUpdating() is ca lled.
34 virtual bool hasLastData() = 0; 36 virtual bool hasLastData() = 0;
35 37
36 bool m_hasEventListener; 38 bool m_hasEventListener;
37 39
38 private: 40 private:
39 // Inherited from PageLifecycleObserver. 41 // Inherited from PageLifecycleObserver.
40 virtual void pageVisibilityChanged() OVERRIDE; 42 virtual void pageVisibilityChanged() OVERRIDE;
41 43
42 void oneShotCallback(Timer<PlatformEventController>*); 44 void oneShotCallback(Timer<PlatformEventController>*);
43 45
44 bool m_isActive; 46 bool m_isActive;
45 Timer<PlatformEventController> m_timer; 47 Timer<PlatformEventController> m_timer;
46 }; 48 };
47 49
48 } // namespace blink 50 } // namespace blink
49 51
50 #endif // PlatformEventController_h 52 #endif // PlatformEventController_h
OLDNEW
« no previous file with comments | « Source/core/frame/DeviceSingleWindowEventController.cpp ('k') | Source/core/frame/PlatformEventDispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698