| 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" | 11 #include "cc/output/output_surface.h" |
| 12 #include "cc/trees/channel_main.h" | 12 #include "cc/trees/channel_main.h" |
| 13 #include "cc/trees/proxy.h" | 13 #include "cc/trees/proxy.h" |
| 14 #include "cc/trees/proxy_common.h" | 14 #include "cc/trees/proxy_common.h" |
| 15 #include "cc/trees/remote_proto_channel.h" | 15 #include "cc/trees/remote_proto_channel.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 class AnimationEvents; | 19 class AnimationEvents; |
| 20 class BeginFrameSource; | 20 class BeginFrameSource; |
| 21 class ChannelMain; | 21 class ChannelMain; |
| 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 SetOutputSurface(OutputSurface* output_surface) override; | 83 void SetOutputSurface(OutputSurface* output_surface) override; |
| 84 void SetVisible(bool visible) override; | 84 void SetVisible(bool visible) override; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 105 | 105 |
| 106 // This sets the channel used by ProxyMain to communicate with ProxyImpl. | 106 // This sets the channel used by ProxyMain to communicate with ProxyImpl. |
| 107 void SetChannel(std::unique_ptr<ChannelMain> channel_main); | 107 void SetChannel(std::unique_ptr<ChannelMain> channel_main); |
| 108 | 108 |
| 109 // Returns |true| if the request was actually sent, |false| if one was | 109 // Returns |true| if the request was actually sent, |false| if one was |
| 110 // already outstanding. | 110 // already outstanding. |
| 111 bool SendCommitRequestToImplThreadIfNeeded( | 111 bool SendCommitRequestToImplThreadIfNeeded( |
| 112 CommitPipelineStage required_stage); | 112 CommitPipelineStage required_stage); |
| 113 bool IsMainThread() const; | 113 bool IsMainThread() const; |
| 114 | 114 |
| 115 LayerTreeHost* layer_tree_host_; | 115 LayerTreeHostInProcess* layer_tree_host_; |
| 116 | 116 |
| 117 TaskRunnerProvider* task_runner_provider_; | 117 TaskRunnerProvider* task_runner_provider_; |
| 118 | 118 |
| 119 const int layer_tree_host_id_; | 119 const int layer_tree_host_id_; |
| 120 | 120 |
| 121 // The furthest pipeline stage which has been requested for the next | 121 // The furthest pipeline stage which has been requested for the next |
| 122 // commit. | 122 // commit. |
| 123 CommitPipelineStage max_requested_pipeline_stage_; | 123 CommitPipelineStage max_requested_pipeline_stage_; |
| 124 // The commit pipeline stage that is currently being processed. | 124 // The commit pipeline stage that is currently being processed. |
| 125 CommitPipelineStage current_pipeline_stage_; | 125 CommitPipelineStage current_pipeline_stage_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 137 bool defer_commits_; | 137 bool defer_commits_; |
| 138 | 138 |
| 139 std::unique_ptr<ChannelMain> channel_main_; | 139 std::unique_ptr<ChannelMain> channel_main_; |
| 140 | 140 |
| 141 DISALLOW_COPY_AND_ASSIGN(ProxyMain); | 141 DISALLOW_COPY_AND_ASSIGN(ProxyMain); |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 } // namespace cc | 144 } // namespace cc |
| 145 | 145 |
| 146 #endif // CC_TREES_PROXY_MAIN_H_ | 146 #endif // CC_TREES_PROXY_MAIN_H_ |
| OLD | NEW |