OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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 CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_BEGIN_FRAME_OBSERVER_IMPL_H_ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_BEGIN_FRAME_OBSERVER_IMPL_H_ | |
7 | |
8 #include "content/common/content_export.h" | |
9 #include "ui/compositor/compositor.h" | |
10 #include "ui/compositor/compositor_observer.h" | |
11 | |
12 namespace cc { | |
13 struct BeginFrameArgs; | |
14 } | |
15 | |
16 namespace content { | |
17 | |
18 // This is the interface from the CompositorBeginFrameObserverImpl which manages | |
19 // sending BeginFrame messages. | |
20 class CompositorBeginFrameObserverImplClient { | |
danakj
2015/03/19 22:36:40
I think it's a layering weird thing to put a Compo
| |
21 public: | |
22 virtual void SendBeginFrame(const cc::BeginFrameArgs& args) = 0; | |
23 }; | |
24 | |
25 // This class is used to manage all of the RenderWidgetHostView state and | |
26 // functionality that is associated with BeginFrame message handling. | |
27 class CONTENT_EXPORT CompositorBeginFrameObserverImpl | |
28 : public ui::CompositorBeginFrameObserver { | |
29 public: | |
30 explicit CompositorBeginFrameObserverImpl( | |
31 CompositorBeginFrameObserverImplClient* client); | |
32 virtual ~CompositorBeginFrameObserverImpl(); | |
33 | |
34 void SetNeedsBeginFrames(bool needs_begin_frames); | |
35 | |
36 void SetCompositor(ui::Compositor* compositor); | |
37 void ResetCompositor(); | |
38 | |
39 // Overridden from ui::CompositorBeginFrameObserver: | |
40 void OnSendBeginFrame(const cc::BeginFrameArgs& args) override; | |
41 | |
42 private: | |
43 void StartObservingBeginFrames(); | |
44 void StopObservingBeginFrames(); | |
45 | |
46 // True when RenderWidget needs a BeginFrame message. | |
47 bool needs_begin_frames_; | |
48 | |
49 // Pass |last_sent_begin_frame_args_| to compositor when |this| is added as a | |
50 // CompositorBeginFrameObserver. With this, Compositor can determine whether | |
51 // latest BeginFrameArgs it has sent can be used immediately or not. | |
52 cc::BeginFrameArgs last_sent_begin_frame_args_; | |
53 | |
54 CompositorBeginFrameObserverImplClient* client_; | |
55 ui::Compositor* compositor_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(CompositorBeginFrameObserverImpl); | |
58 }; | |
59 | |
60 } // namespace content | |
61 | |
62 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_BEGIN_FRAME_OBSERVER_IMPL_H_ | |
OLD | NEW |