OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 CC_TREES_CHANNEL_MAIN_H_ | 5 #ifndef CC_TREES_CHANNEL_MAIN_H_ |
6 #define CC_TREES_CHANNEL_MAIN_H_ | 6 #define CC_TREES_CHANNEL_MAIN_H_ |
7 | 7 |
8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
9 #include "cc/base/completion_event.h" | 9 #include "cc/base/completion_event.h" |
10 #include "cc/input/top_controls_state.h" | 10 #include "cc/input/top_controls_state.h" |
11 #include "cc/output/output_surface.h" | 11 #include "cc/output/output_surface.h" |
| 12 #include "cc/scheduler/begin_frame_source.h" |
12 #include "cc/scheduler/commit_earlyout_reason.h" | 13 #include "cc/scheduler/commit_earlyout_reason.h" |
13 #include "cc/trees/proxy_common.h" | 14 #include "cc/trees/proxy_common.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
| 17 |
16 // ChannelMain and ChannelImpl provide an abstract communication layer for | 18 // ChannelMain and ChannelImpl provide an abstract communication layer for |
17 // the main and impl side of the compositor. | 19 // the main and impl side of the compositor. |
18 // | 20 // |
19 // The communication sequence between the 2 sides is: | 21 // The communication sequence between the 2 sides is: |
20 // | 22 // |
21 // LayerTreeHost<-->ProxyMain<-->ChannelMain | 23 // LayerTreeHost<-->ProxyMain<-->ChannelMain |
22 // | | 24 // | |
23 // | | 25 // | |
24 // ChannelImpl<-->ProxyImpl<-->LayerTreeHostImpl | 26 // ChannelImpl<-->ProxyImpl<-->LayerTreeHostImpl |
25 | 27 |
26 class CC_EXPORT ChannelMain { | 28 class CC_EXPORT ChannelMain { |
27 public: | 29 public: |
28 // Interface for commands sent to the ProxyImpl | 30 virtual ~ChannelMain() {} |
| 31 |
| 32 // Interface for commands sent to ProxyImpl |
29 virtual void SetThrottleFrameProductionOnImpl(bool throttle) = 0; | 33 virtual void SetThrottleFrameProductionOnImpl(bool throttle) = 0; |
30 virtual void UpdateTopControlsStateOnImpl(TopControlsState constraints, | 34 virtual void UpdateTopControlsStateOnImpl(TopControlsState constraints, |
31 TopControlsState current, | 35 TopControlsState current, |
32 bool animate) = 0; | 36 bool animate) = 0; |
33 virtual void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface) = 0; | 37 virtual void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface) = 0; |
34 virtual void MainThreadHasStoppedFlingingOnImpl() = 0; | 38 virtual void MainThreadHasStoppedFlingingOnImpl() = 0; |
35 virtual void SetInputThrottledUntilCommitOnImpl(bool is_throttled) = 0; | 39 virtual void SetInputThrottledUntilCommitOnImpl(bool is_throttled) = 0; |
36 virtual void SetDeferCommitsOnImpl(bool defer_commits) = 0; | 40 virtual void SetDeferCommitsOnImpl(bool defer_commits) = 0; |
37 virtual void FinishAllRenderingOnImpl(CompletionEvent* completion) = 0; | 41 virtual void FinishAllRenderingOnImpl(CompletionEvent* completion) = 0; |
38 virtual void SetVisibleOnImpl(bool visible) = 0; | 42 virtual void SetVisibleOnImpl(bool visible) = 0; |
39 virtual void ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) = 0; | 43 virtual void ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) = 0; |
40 virtual void FinishGLOnImpl(CompletionEvent* completion) = 0; | |
41 virtual void MainFrameWillHappenOnImplForTesting( | 44 virtual void MainFrameWillHappenOnImplForTesting( |
42 CompletionEvent* completion, | 45 CompletionEvent* completion, |
43 bool* main_frame_will_happen) = 0; | 46 bool* main_frame_will_happen) = 0; |
44 virtual void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) = 0; | 47 virtual void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) = 0; |
45 virtual void SetNeedsCommitOnImpl() = 0; | 48 virtual void SetNeedsCommitOnImpl() = 0; |
46 virtual void BeginMainFrameAbortedOnImpl( | 49 virtual void BeginMainFrameAbortedOnImpl( |
47 CommitEarlyOutReason reason, | 50 CommitEarlyOutReason reason, |
48 base::TimeTicks main_thread_start_time) = 0; | 51 base::TimeTicks main_thread_start_time) = 0; |
49 virtual void StartCommitOnImpl(CompletionEvent* completion, | 52 virtual void StartCommitOnImpl(CompletionEvent* completion, |
50 LayerTreeHost* layer_tree_host, | 53 LayerTreeHost* layer_tree_host, |
51 base::TimeTicks main_thread_start_time, | 54 base::TimeTicks main_thread_start_time, |
52 bool hold_commit_for_activation) = 0; | 55 bool hold_commit_for_activation) = 0; |
53 virtual void InitializeImplOnImpl(CompletionEvent* completion, | |
54 LayerTreeHost* layer_tree_host) = 0; | |
55 virtual void LayerTreeHostClosedOnImpl(CompletionEvent* completion) = 0; | |
56 | 56 |
57 virtual ~ChannelMain() {} | 57 // Must be called before using the channel. |
| 58 virtual void SynchronouslyInitializeImpl( |
| 59 LayerTreeHost* layer_tree_host, |
| 60 scoped_ptr<BeginFrameSource> external_begin_frame_source) = 0; |
| 61 |
| 62 // Must be called before deleting the channel. |
| 63 virtual void SynchronouslyCloseImpl() = 0; |
58 }; | 64 }; |
59 | 65 |
60 } // namespace cc | 66 } // namespace cc |
61 | 67 |
62 #endif // CC_TREES_CHANNEL_MAIN_H_ | 68 #endif // CC_TREES_CHANNEL_MAIN_H_ |
OLD | NEW |