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/trees/channel_main.h" | 11 #include "cc/trees/channel_main.h" |
12 #include "cc/trees/proxy.h" | 12 #include "cc/trees/proxy.h" |
13 #include "cc/trees/proxy_common.h" | 13 #include "cc/trees/proxy_common.h" |
14 #include "cc/trees/remote_proto_channel.h" | 14 #include "cc/trees/remote_proto_channel.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 class AnimationEvents; | 18 class AnimationEvents; |
19 class BeginFrameSource; | 19 class BeginFrameSource; |
20 class ChannelMain; | 20 class ChannelMain; |
21 class CompositorFrameSink; | 21 class CompositorFrameSink; |
22 class LayerTreeHost; | 22 class LayerTreeHostInProcess; |
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 LayerTreeHostInProcess* layer_tree_host, |
32 TaskRunnerProvider* task_runner_provider); | 32 TaskRunnerProvider* task_runner_provider); |
33 | 33 |
34 static std::unique_ptr<ProxyMain> CreateRemote( | 34 static std::unique_ptr<ProxyMain> CreateRemote( |
35 RemoteProtoChannel* remote_proto_channel, | 35 RemoteProtoChannel* remote_proto_channel, |
36 LayerTreeHost* layer_tree_host, | 36 LayerTreeHostInProcess* layer_tree_host, |
37 TaskRunnerProvider* task_runner_provider); | 37 TaskRunnerProvider* task_runner_provider); |
38 | 38 |
39 ~ProxyMain() override; | 39 ~ProxyMain() override; |
40 | 40 |
41 // Commits between the main and impl threads are processed through a pipeline | 41 // Commits between the main and impl threads are processed through a pipeline |
42 // with the following stages. For efficiency we can early out at any stage if | 42 // with the following stages. For efficiency we can early out at any stage if |
43 // we decide that no further processing is necessary. | 43 // we decide that no further processing is necessary. |
44 enum CommitPipelineStage { | 44 enum CommitPipelineStage { |
45 NO_PIPELINE_STAGE, | 45 NO_PIPELINE_STAGE, |
46 ANIMATE_PIPELINE_STAGE, | 46 ANIMATE_PIPELINE_STAGE, |
(...skipping 17 matching lines...) Expand all Loading... |
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(LayerTreeHostInProcess* 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 SetCompositorFrameSink( | 83 void SetCompositorFrameSink( |
84 CompositorFrameSink* compositor_frame_sink) override; | 84 CompositorFrameSink* compositor_frame_sink) override; |
(...skipping 21 matching lines...) Expand all Loading... |
106 | 106 |
107 // This sets the channel used by ProxyMain to communicate with ProxyImpl. | 107 // This sets the channel used by ProxyMain to communicate with ProxyImpl. |
108 void SetChannel(std::unique_ptr<ChannelMain> channel_main); | 108 void SetChannel(std::unique_ptr<ChannelMain> channel_main); |
109 | 109 |
110 // 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 |
111 // already outstanding. | 111 // already outstanding. |
112 bool SendCommitRequestToImplThreadIfNeeded( | 112 bool SendCommitRequestToImplThreadIfNeeded( |
113 CommitPipelineStage required_stage); | 113 CommitPipelineStage required_stage); |
114 bool IsMainThread() const; | 114 bool IsMainThread() const; |
115 | 115 |
116 LayerTreeHost* layer_tree_host_; | 116 LayerTreeHostInProcess* layer_tree_host_; |
117 | 117 |
118 TaskRunnerProvider* task_runner_provider_; | 118 TaskRunnerProvider* task_runner_provider_; |
119 | 119 |
120 const int layer_tree_host_id_; | 120 const int layer_tree_host_id_; |
121 | 121 |
122 // The furthest pipeline stage which has been requested for the next | 122 // The furthest pipeline stage which has been requested for the next |
123 // commit. | 123 // commit. |
124 CommitPipelineStage max_requested_pipeline_stage_; | 124 CommitPipelineStage max_requested_pipeline_stage_; |
125 // The commit pipeline stage that is currently being processed. | 125 // The commit pipeline stage that is currently being processed. |
126 CommitPipelineStage current_pipeline_stage_; | 126 CommitPipelineStage current_pipeline_stage_; |
(...skipping 11 matching lines...) Expand all Loading... |
138 bool defer_commits_; | 138 bool defer_commits_; |
139 | 139 |
140 std::unique_ptr<ChannelMain> channel_main_; | 140 std::unique_ptr<ChannelMain> channel_main_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(ProxyMain); | 142 DISALLOW_COPY_AND_ASSIGN(ProxyMain); |
143 }; | 143 }; |
144 | 144 |
145 } // namespace cc | 145 } // namespace cc |
146 | 146 |
147 #endif // CC_TREES_PROXY_MAIN_H_ | 147 #endif // CC_TREES_PROXY_MAIN_H_ |
OLD | NEW |