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