| 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/animation/animation_events.h" | 9 #include "cc/animation/animation_events.h" |
| 10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class ChannelMain; | 21 class ChannelMain; |
| 22 class LayerTreeHost; | 22 class LayerTreeHost; |
| 23 | 23 |
| 24 // This class aggregates all interactions that the impl side of the compositor | 24 // This class aggregates all interactions that the impl side of the compositor |
| 25 // needs to have with the main side. | 25 // needs to have with the main side. |
| 26 // The class is created and lives on the main thread. | 26 // The class is created and lives on the main thread. |
| 27 class CC_EXPORT ProxyMain : public Proxy { | 27 class CC_EXPORT ProxyMain : public Proxy { |
| 28 public: | 28 public: |
| 29 static scoped_ptr<ProxyMain> CreateThreaded( | 29 static scoped_ptr<ProxyMain> CreateThreaded( |
| 30 LayerTreeHost* layer_tree_host, | 30 LayerTreeHost* layer_tree_host, |
| 31 TaskRunnerProvider* task_runner_provider, | 31 TaskRunnerProvider* task_runner_provider); |
| 32 scoped_ptr<BeginFrameSource> external_begin_frame_source); | |
| 33 | 32 |
| 34 ~ProxyMain() override; | 33 ~ProxyMain() override; |
| 35 | 34 |
| 36 // Commits between the main and impl threads are processed through a pipeline | 35 // Commits between the main and impl threads are processed through a pipeline |
| 37 // with the following stages. For efficiency we can early out at any stage if | 36 // with the following stages. For efficiency we can early out at any stage if |
| 38 // we decide that no further processing is necessary. | 37 // we decide that no further processing is necessary. |
| 39 enum CommitPipelineStage { | 38 enum CommitPipelineStage { |
| 40 NO_PIPELINE_STAGE, | 39 NO_PIPELINE_STAGE, |
| 41 ANIMATE_PIPELINE_STAGE, | 40 ANIMATE_PIPELINE_STAGE, |
| 42 UPDATE_LAYERS_PIPELINE_STAGE, | 41 UPDATE_LAYERS_PIPELINE_STAGE, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 68 } | 67 } |
| 69 CommitPipelineStage current_pipeline_stage() const { | 68 CommitPipelineStage current_pipeline_stage() const { |
| 70 return current_pipeline_stage_; | 69 return current_pipeline_stage_; |
| 71 } | 70 } |
| 72 CommitPipelineStage final_pipeline_stage() const { | 71 CommitPipelineStage final_pipeline_stage() const { |
| 73 return final_pipeline_stage_; | 72 return final_pipeline_stage_; |
| 74 } | 73 } |
| 75 | 74 |
| 76 protected: | 75 protected: |
| 77 ProxyMain(LayerTreeHost* layer_tree_host, | 76 ProxyMain(LayerTreeHost* layer_tree_host, |
| 78 TaskRunnerProvider* task_runner_provider, | 77 TaskRunnerProvider* task_runner_provider); |
| 79 scoped_ptr<BeginFrameSource> external_begin_frame_source); | |
| 80 | 78 |
| 81 private: | 79 private: |
| 82 friend class ProxyMainForTest; | 80 friend class ProxyMainForTest; |
| 83 | 81 |
| 84 // Proxy implementation. | 82 // Proxy implementation. |
| 85 void FinishAllRendering() override; | 83 void FinishAllRendering() override; |
| 86 bool IsStarted() const override; | 84 bool IsStarted() const override; |
| 87 bool CommitToActiveTree() const override; | 85 bool CommitToActiveTree() const override; |
| 88 void SetOutputSurface(OutputSurface* output_surface) override; | 86 void SetOutputSurface(OutputSurface* output_surface) override; |
| 89 void SetVisible(bool visible) override; | 87 void SetVisible(bool visible) override; |
| 90 void SetThrottleFrameProduction(bool throttle) override; | 88 void SetThrottleFrameProduction(bool throttle) override; |
| 91 const RendererCapabilities& GetRendererCapabilities() const override; | 89 const RendererCapabilities& GetRendererCapabilities() const override; |
| 92 void SetNeedsAnimate() override; | 90 void SetNeedsAnimate() override; |
| 93 void SetNeedsUpdateLayers() override; | 91 void SetNeedsUpdateLayers() override; |
| 94 void SetNeedsCommit() override; | 92 void SetNeedsCommit() override; |
| 95 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; | 93 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; |
| 96 void SetNextCommitWaitsForActivation() override; | 94 void SetNextCommitWaitsForActivation() override; |
| 97 void NotifyInputThrottledUntilCommit() override; | 95 void NotifyInputThrottledUntilCommit() override; |
| 98 void SetDeferCommits(bool defer_commits) override; | 96 void SetDeferCommits(bool defer_commits) override; |
| 99 bool CommitRequested() const override; | 97 bool CommitRequested() const override; |
| 100 bool BeginMainFrameRequested() const override; | 98 bool BeginMainFrameRequested() const override; |
| 101 void MainThreadHasStoppedFlinging() override; | 99 void MainThreadHasStoppedFlinging() override; |
| 102 void Start() override; | 100 void Start(scoped_ptr<BeginFrameSource> external_begin_frame_source) override; |
| 103 void Stop() override; | 101 void Stop() override; |
| 104 bool SupportsImplScrolling() const override; | 102 bool SupportsImplScrolling() const override; |
| 105 bool MainFrameWillHappenForTesting() override; | 103 bool MainFrameWillHappenForTesting() override; |
| 106 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) override; | 104 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) override; |
| 107 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) override; | 105 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) override; |
| 108 void ReleaseOutputSurface() override; | 106 void ReleaseOutputSurface() override; |
| 109 void UpdateTopControlsState(TopControlsState constraints, | 107 void UpdateTopControlsState(TopControlsState constraints, |
| 110 TopControlsState current, | 108 TopControlsState current, |
| 111 bool animate) override; | 109 bool animate) override; |
| 112 | 110 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 138 bool commit_waits_for_activation_; | 136 bool commit_waits_for_activation_; |
| 139 | 137 |
| 140 // Set when the Proxy is started using Proxy::Start() and reset when it is | 138 // Set when the Proxy is started using Proxy::Start() and reset when it is |
| 141 // stopped using Proxy::Stop(). | 139 // stopped using Proxy::Stop(). |
| 142 bool started_; | 140 bool started_; |
| 143 | 141 |
| 144 bool defer_commits_; | 142 bool defer_commits_; |
| 145 | 143 |
| 146 RendererCapabilities renderer_capabilities_; | 144 RendererCapabilities renderer_capabilities_; |
| 147 | 145 |
| 148 // This holds a valid value only until ProxyImpl is created on the impl thread | |
| 149 // with InitializeImplOnImpl(). | |
| 150 // TODO(khushalsagar): Remove the use of this temporary variable. | |
| 151 // See crbug/567930. | |
| 152 scoped_ptr<BeginFrameSource> external_begin_frame_source_; | |
| 153 | |
| 154 scoped_ptr<ChannelMain> channel_main_; | 146 scoped_ptr<ChannelMain> channel_main_; |
| 155 | 147 |
| 156 DISALLOW_COPY_AND_ASSIGN(ProxyMain); | 148 DISALLOW_COPY_AND_ASSIGN(ProxyMain); |
| 157 }; | 149 }; |
| 158 | 150 |
| 159 } // namespace cc | 151 } // namespace cc |
| 160 | 152 |
| 161 #endif // CC_TREES_PROXY_MAIN_H_ | 153 #endif // CC_TREES_PROXY_MAIN_H_ |
| OLD | NEW |