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_PROXY_IMPL_H_ | 5 #ifndef CC_TREES_PROXY_IMPL_H_ |
6 #define CC_TREES_PROXY_IMPL_H_ | 6 #define CC_TREES_PROXY_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "cc/base/completion_event.h" | 11 #include "cc/base/completion_event.h" |
12 #include "cc/base/delayed_unique_notifier.h" | 12 #include "cc/base/delayed_unique_notifier.h" |
13 #include "cc/input/top_controls_state.h" | 13 #include "cc/input/top_controls_state.h" |
14 #include "cc/scheduler/scheduler.h" | 14 #include "cc/scheduler/scheduler.h" |
15 #include "cc/trees/channel_impl.h" | 15 #include "cc/trees/channel_impl.h" |
16 #include "cc/trees/layer_tree_host_impl.h" | 16 #include "cc/trees/layer_tree_host_impl.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
| 19 class LayerTreeHostInProcess; |
19 | 20 |
20 // This class aggregates all the interactions that the main side of the | 21 // This class aggregates all the interactions that the main side of the |
21 // compositor needs to have with the impl side. It is created and owned by the | 22 // compositor needs to have with the impl side. It is created and owned by the |
22 // ChannelImpl implementation. The class lives entirely on the impl thread. | 23 // ChannelImpl implementation. The class lives entirely on the impl thread. |
23 class CC_EXPORT ProxyImpl : public NON_EXPORTED_BASE(LayerTreeHostImplClient), | 24 class CC_EXPORT ProxyImpl : public NON_EXPORTED_BASE(LayerTreeHostImplClient), |
24 public NON_EXPORTED_BASE(SchedulerClient) { | 25 public NON_EXPORTED_BASE(SchedulerClient) { |
25 public: | 26 public: |
26 ProxyImpl(ChannelImpl* channel_impl, | 27 ProxyImpl(ChannelImpl* channel_impl, |
27 LayerTreeHost* layer_tree_host, | 28 LayerTreeHostInProcess* layer_tree_host, |
28 TaskRunnerProvider* task_runner_provider, | 29 TaskRunnerProvider* task_runner_provider, |
29 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | 30 std::unique_ptr<BeginFrameSource> external_begin_frame_source); |
30 ~ProxyImpl() override; | 31 ~ProxyImpl() override; |
31 | 32 |
32 // Virtual for testing. | 33 // Virtual for testing. |
33 void UpdateTopControlsStateOnImpl(TopControlsState constraints, | 34 void UpdateTopControlsStateOnImpl(TopControlsState constraints, |
34 TopControlsState current, | 35 TopControlsState current, |
35 bool animate); | 36 bool animate); |
36 void InitializeCompositorFrameSinkOnImpl( | 37 void InitializeCompositorFrameSinkOnImpl( |
37 CompositorFrameSink* compositor_frame_sink); | 38 CompositorFrameSink* compositor_frame_sink); |
38 void InitializeMutatorOnImpl(std::unique_ptr<LayerTreeMutator> mutator); | 39 void InitializeMutatorOnImpl(std::unique_ptr<LayerTreeMutator> mutator); |
39 void MainThreadHasStoppedFlingingOnImpl(); | 40 void MainThreadHasStoppedFlingingOnImpl(); |
40 void SetInputThrottledUntilCommitOnImpl(bool is_throttled); | 41 void SetInputThrottledUntilCommitOnImpl(bool is_throttled); |
41 void SetDeferCommitsOnImpl(bool defer_commits) const; | 42 void SetDeferCommitsOnImpl(bool defer_commits) const; |
42 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect); | 43 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect); |
43 void SetNeedsCommitOnImpl(); | 44 void SetNeedsCommitOnImpl(); |
44 void BeginMainFrameAbortedOnImpl( | 45 void BeginMainFrameAbortedOnImpl( |
45 CommitEarlyOutReason reason, | 46 CommitEarlyOutReason reason, |
46 base::TimeTicks main_thread_start_time, | 47 base::TimeTicks main_thread_start_time, |
47 std::vector<std::unique_ptr<SwapPromise>> swap_promises); | 48 std::vector<std::unique_ptr<SwapPromise>> swap_promises); |
48 void SetVisibleOnImpl(bool visible); | 49 void SetVisibleOnImpl(bool visible); |
49 void ReleaseCompositorFrameSinkOnImpl(CompletionEvent* completion); | 50 void ReleaseCompositorFrameSinkOnImpl(CompletionEvent* completion); |
50 void FinishGLOnImpl(CompletionEvent* completion); | 51 void FinishGLOnImpl(CompletionEvent* completion); |
51 void NotifyReadyToCommitOnImpl(CompletionEvent* completion, | 52 void NotifyReadyToCommitOnImpl(CompletionEvent* completion, |
52 LayerTreeHost* layer_tree_host, | 53 LayerTreeHostInProcess* layer_tree_host, |
53 base::TimeTicks main_thread_start_time, | 54 base::TimeTicks main_thread_start_time, |
54 bool hold_commit_for_activation); | 55 bool hold_commit_for_activation); |
55 | 56 |
56 void MainFrameWillHappenOnImplForTesting(CompletionEvent* completion, | 57 void MainFrameWillHappenOnImplForTesting(CompletionEvent* completion, |
57 bool* main_frame_will_happen); | 58 bool* main_frame_will_happen); |
58 | 59 |
59 private: | 60 private: |
60 // The members of this struct should be accessed on the impl thread only when | 61 // The members of this struct should be accessed on the impl thread only when |
61 // the main thread is blocked for a commit. | 62 // the main thread is blocked for a commit. |
62 struct BlockedMainCommitOnly { | 63 struct BlockedMainCommitOnly { |
63 BlockedMainCommitOnly(); | 64 BlockedMainCommitOnly(); |
64 ~BlockedMainCommitOnly(); | 65 ~BlockedMainCommitOnly(); |
65 LayerTreeHost* layer_tree_host; | 66 LayerTreeHostInProcess* layer_tree_host; |
66 }; | 67 }; |
67 | 68 |
68 // LayerTreeHostImplClient implementation | 69 // LayerTreeHostImplClient implementation |
69 void DidLoseCompositorFrameSinkOnImplThread() override; | 70 void DidLoseCompositorFrameSinkOnImplThread() override; |
70 void SetBeginFrameSource(BeginFrameSource* source) override; | 71 void SetBeginFrameSource(BeginFrameSource* source) override; |
71 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override; | 72 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override; |
72 void DidSwapBuffersCompleteOnImplThread() override; | 73 void DidSwapBuffersCompleteOnImplThread() override; |
73 void OnCanDrawStateChanged(bool can_draw) override; | 74 void OnCanDrawStateChanged(bool can_draw) override; |
74 void NotifyReadyToActivate() override; | 75 void NotifyReadyToActivate() override; |
75 void NotifyReadyToDraw() override; | 76 void NotifyReadyToDraw() override; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // Use accessors instead of this variable directly. | 148 // Use accessors instead of this variable directly. |
148 BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_; | 149 BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_; |
149 BlockedMainCommitOnly& blocked_main_commit(); | 150 BlockedMainCommitOnly& blocked_main_commit(); |
150 | 151 |
151 DISALLOW_COPY_AND_ASSIGN(ProxyImpl); | 152 DISALLOW_COPY_AND_ASSIGN(ProxyImpl); |
152 }; | 153 }; |
153 | 154 |
154 } // namespace cc | 155 } // namespace cc |
155 | 156 |
156 #endif // CC_TREES_PROXY_IMPL_H_ | 157 #endif // CC_TREES_PROXY_IMPL_H_ |
OLD | NEW |