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

Side by Side Diff: sky/engine/core/frame/PlatformEventController.h

Issue 870413002: Remove PlatformEvent (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SKY_ENGINE_CORE_FRAME_PLATFORMEVENTCONTROLLER_H_
6 #define SKY_ENGINE_CORE_FRAME_PLATFORMEVENTCONTROLLER_H_
7
8 #include "sky/engine/core/page/PageLifecycleObserver.h"
9 #include "sky/engine/platform/Timer.h"
10 #include "sky/engine/platform/heap/Handle.h"
11
12 namespace blink {
13
14 // Base controller class for registering controllers with a dispatcher.
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
17 // it available.
18 class PlatformEventController : public PageLifecycleObserver {
19 public:
20 void startUpdating();
21 void stopUpdating();
22
23 // This is called when new data becomes available.
24 virtual void didUpdateData() = 0;
25
26 protected:
27 explicit PlatformEventController(Page*);
28 virtual ~PlatformEventController();
29
30 virtual void registerWithDispatcher() = 0;
31 virtual void unregisterWithDispatcher() = 0;
32
33 // When true initiates a one-shot didUpdateData() when startUpdating() is ca lled.
34 virtual bool hasLastData() = 0;
35
36 bool m_hasEventListener;
37
38 private:
39 // Inherited from PageLifecycleObserver.
40 virtual void pageVisibilityChanged() override;
41
42 void oneShotCallback(Timer<PlatformEventController>*);
43
44 bool m_isActive;
45 Timer<PlatformEventController> m_timer;
46 };
47
48 } // namespace blink
49
50 #endif // SKY_ENGINE_CORE_FRAME_PLATFORMEVENTCONTROLLER_H_
OLDNEW
« no previous file with comments | « sky/engine/core/frame/NewEventHandler.cpp ('k') | sky/engine/core/frame/PlatformEventController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698