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_MAIN_H_ | 5 #ifndef CC_TREES_PROXY_MAIN_H_ |
6 #define CC_TREES_PROXY_MAIN_H_ | 6 #define CC_TREES_PROXY_MAIN_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/input/top_controls_state.h" | 10 #include "cc/input/top_controls_state.h" |
11 #include "cc/output/output_surface.h" | |
12 #include "cc/trees/channel_main.h" | 11 #include "cc/trees/channel_main.h" |
13 #include "cc/trees/proxy.h" | 12 #include "cc/trees/proxy.h" |
14 #include "cc/trees/proxy_common.h" | 13 #include "cc/trees/proxy_common.h" |
15 #include "cc/trees/remote_proto_channel.h" | 14 #include "cc/trees/remote_proto_channel.h" |
16 | 15 |
17 namespace cc { | 16 namespace cc { |
18 | 17 |
19 class AnimationEvents; | 18 class AnimationEvents; |
20 class BeginFrameSource; | 19 class BeginFrameSource; |
21 class ChannelMain; | 20 class ChannelMain; |
| 21 class CompositorFrameSink; |
22 class LayerTreeHost; | 22 class LayerTreeHost; |
23 class LayerTreeMutator; | 23 class LayerTreeMutator; |
24 | 24 |
25 // This class aggregates all interactions that the impl side of the compositor | 25 // This class aggregates all interactions that the impl side of the compositor |
26 // needs to have with the main side. | 26 // needs to have with the main side. |
27 // The class is created and lives on the main thread. | 27 // The class is created and lives on the main thread. |
28 class CC_EXPORT ProxyMain : public Proxy { | 28 class CC_EXPORT ProxyMain : public Proxy { |
29 public: | 29 public: |
30 static std::unique_ptr<ProxyMain> CreateThreaded( | 30 static std::unique_ptr<ProxyMain> CreateThreaded( |
31 LayerTreeHost* layer_tree_host, | 31 LayerTreeHost* layer_tree_host, |
(...skipping 13 matching lines...) Expand all Loading... |
45 NO_PIPELINE_STAGE, | 45 NO_PIPELINE_STAGE, |
46 ANIMATE_PIPELINE_STAGE, | 46 ANIMATE_PIPELINE_STAGE, |
47 UPDATE_LAYERS_PIPELINE_STAGE, | 47 UPDATE_LAYERS_PIPELINE_STAGE, |
48 COMMIT_PIPELINE_STAGE, | 48 COMMIT_PIPELINE_STAGE, |
49 }; | 49 }; |
50 | 50 |
51 void DidCompleteSwapBuffers(); | 51 void DidCompleteSwapBuffers(); |
52 void BeginMainFrameNotExpectedSoon(); | 52 void BeginMainFrameNotExpectedSoon(); |
53 void DidCommitAndDrawFrame(); | 53 void DidCommitAndDrawFrame(); |
54 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events); | 54 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events); |
55 void DidLoseOutputSurface(); | 55 void DidLoseCompositorFrameSink(); |
56 void RequestNewOutputSurface(); | 56 void RequestNewCompositorFrameSink(); |
57 void DidInitializeOutputSurface(bool success); | 57 void DidInitializeCompositorFrameSink(bool success); |
58 void DidCompletePageScaleAnimation(); | 58 void DidCompletePageScaleAnimation(); |
59 void BeginMainFrame( | 59 void BeginMainFrame( |
60 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state); | 60 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state); |
61 | 61 |
62 ChannelMain* channel_main() const { return channel_main_.get(); } | 62 ChannelMain* channel_main() const { return channel_main_.get(); } |
63 CommitPipelineStage max_requested_pipeline_stage() const { | 63 CommitPipelineStage max_requested_pipeline_stage() const { |
64 return max_requested_pipeline_stage_; | 64 return max_requested_pipeline_stage_; |
65 } | 65 } |
66 CommitPipelineStage current_pipeline_stage() const { | 66 CommitPipelineStage current_pipeline_stage() const { |
67 return current_pipeline_stage_; | 67 return current_pipeline_stage_; |
68 } | 68 } |
69 CommitPipelineStage final_pipeline_stage() const { | 69 CommitPipelineStage final_pipeline_stage() const { |
70 return final_pipeline_stage_; | 70 return final_pipeline_stage_; |
71 } | 71 } |
72 | 72 |
73 protected: | 73 protected: |
74 ProxyMain(LayerTreeHost* layer_tree_host, | 74 ProxyMain(LayerTreeHost* layer_tree_host, |
75 TaskRunnerProvider* task_runner_provider); | 75 TaskRunnerProvider* task_runner_provider); |
76 | 76 |
77 private: | 77 private: |
78 friend class ProxyMainForTest; | 78 friend class ProxyMainForTest; |
79 | 79 |
80 // Proxy implementation. | 80 // Proxy implementation. |
81 bool IsStarted() const override; | 81 bool IsStarted() const override; |
82 bool CommitToActiveTree() const override; | 82 bool CommitToActiveTree() const override; |
83 void SetOutputSurface(OutputSurface* output_surface) override; | 83 void SetCompositorFrameSink( |
| 84 CompositorFrameSink* compositor_frame_sink) override; |
84 void SetVisible(bool visible) override; | 85 void SetVisible(bool visible) override; |
85 void SetNeedsAnimate() override; | 86 void SetNeedsAnimate() override; |
86 void SetNeedsUpdateLayers() override; | 87 void SetNeedsUpdateLayers() override; |
87 void SetNeedsCommit() override; | 88 void SetNeedsCommit() override; |
88 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; | 89 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; |
89 void SetNextCommitWaitsForActivation() override; | 90 void SetNextCommitWaitsForActivation() override; |
90 void NotifyInputThrottledUntilCommit() override; | 91 void NotifyInputThrottledUntilCommit() override; |
91 void SetDeferCommits(bool defer_commits) override; | 92 void SetDeferCommits(bool defer_commits) override; |
92 bool CommitRequested() const override; | 93 bool CommitRequested() const override; |
93 bool BeginMainFrameRequested() const override; | 94 bool BeginMainFrameRequested() const override; |
94 void MainThreadHasStoppedFlinging() override; | 95 void MainThreadHasStoppedFlinging() override; |
95 void Start( | 96 void Start( |
96 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override; | 97 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override; |
97 void Stop() override; | 98 void Stop() override; |
98 bool SupportsImplScrolling() const override; | 99 bool SupportsImplScrolling() const override; |
99 void SetMutator(std::unique_ptr<LayerTreeMutator> mutator) override; | 100 void SetMutator(std::unique_ptr<LayerTreeMutator> mutator) override; |
100 bool MainFrameWillHappenForTesting() override; | 101 bool MainFrameWillHappenForTesting() override; |
101 void ReleaseOutputSurface() override; | 102 void ReleaseCompositorFrameSink() override; |
102 void UpdateTopControlsState(TopControlsState constraints, | 103 void UpdateTopControlsState(TopControlsState constraints, |
103 TopControlsState current, | 104 TopControlsState current, |
104 bool animate) override; | 105 bool animate) override; |
105 | 106 |
106 // This sets the channel used by ProxyMain to communicate with ProxyImpl. | 107 // This sets the channel used by ProxyMain to communicate with ProxyImpl. |
107 void SetChannel(std::unique_ptr<ChannelMain> channel_main); | 108 void SetChannel(std::unique_ptr<ChannelMain> channel_main); |
108 | 109 |
109 // Returns |true| if the request was actually sent, |false| if one was | 110 // Returns |true| if the request was actually sent, |false| if one was |
110 // already outstanding. | 111 // already outstanding. |
111 bool SendCommitRequestToImplThreadIfNeeded( | 112 bool SendCommitRequestToImplThreadIfNeeded( |
(...skipping 25 matching lines...) Expand all Loading... |
137 bool defer_commits_; | 138 bool defer_commits_; |
138 | 139 |
139 std::unique_ptr<ChannelMain> channel_main_; | 140 std::unique_ptr<ChannelMain> channel_main_; |
140 | 141 |
141 DISALLOW_COPY_AND_ASSIGN(ProxyMain); | 142 DISALLOW_COPY_AND_ASSIGN(ProxyMain); |
142 }; | 143 }; |
143 | 144 |
144 } // namespace cc | 145 } // namespace cc |
145 | 146 |
146 #endif // CC_TREES_PROXY_MAIN_H_ | 147 #endif // CC_TREES_PROXY_MAIN_H_ |
OLD | NEW |