| 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/debug/frame_timing_tracker.h" | 10 #include "cc/debug/frame_timing_tracker.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class AnimationEvents; | 21 class AnimationEvents; |
| 22 class BeginFrameSource; | 22 class BeginFrameSource; |
| 23 class ChannelMain; | 23 class ChannelMain; |
| 24 class LayerTreeHost; | 24 class LayerTreeHost; |
| 25 | 25 |
| 26 // This class aggregates all interactions that the impl side of the compositor | 26 // This class aggregates all interactions that the impl side of the compositor |
| 27 // needs to have with the main side. | 27 // needs to have with the main side. |
| 28 // The class is created and lives on the main thread. | 28 // The class is created and lives on the main thread. |
| 29 class CC_EXPORT ProxyMain : public Proxy { | 29 class CC_EXPORT ProxyMain : public Proxy { |
| 30 public: | 30 public: |
| 31 static scoped_ptr<ProxyMain> CreateThreaded( | 31 static std::unique_ptr<ProxyMain> CreateThreaded( |
| 32 LayerTreeHost* layer_tree_host, | 32 LayerTreeHost* layer_tree_host, |
| 33 TaskRunnerProvider* task_runner_provider); | 33 TaskRunnerProvider* task_runner_provider); |
| 34 | 34 |
| 35 static scoped_ptr<ProxyMain> CreateRemote( | 35 static std::unique_ptr<ProxyMain> CreateRemote( |
| 36 RemoteProtoChannel* remote_proto_channel, | 36 RemoteProtoChannel* remote_proto_channel, |
| 37 LayerTreeHost* layer_tree_host, | 37 LayerTreeHost* layer_tree_host, |
| 38 TaskRunnerProvider* task_runner_provider); | 38 TaskRunnerProvider* task_runner_provider); |
| 39 | 39 |
| 40 ~ProxyMain() override; | 40 ~ProxyMain() override; |
| 41 | 41 |
| 42 // Commits between the main and impl threads are processed through a pipeline | 42 // Commits between the main and impl threads are processed through a pipeline |
| 43 // with the following stages. For efficiency we can early out at any stage if | 43 // with the following stages. For efficiency we can early out at any stage if |
| 44 // we decide that no further processing is necessary. | 44 // we decide that no further processing is necessary. |
| 45 enum CommitPipelineStage { | 45 enum CommitPipelineStage { |
| 46 NO_PIPELINE_STAGE, | 46 NO_PIPELINE_STAGE, |
| 47 ANIMATE_PIPELINE_STAGE, | 47 ANIMATE_PIPELINE_STAGE, |
| 48 UPDATE_LAYERS_PIPELINE_STAGE, | 48 UPDATE_LAYERS_PIPELINE_STAGE, |
| 49 COMMIT_PIPELINE_STAGE, | 49 COMMIT_PIPELINE_STAGE, |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // Virtual for testing. | 52 // Virtual for testing. |
| 53 virtual void DidCompleteSwapBuffers(); | 53 virtual void DidCompleteSwapBuffers(); |
| 54 virtual void SetRendererCapabilities( | 54 virtual void SetRendererCapabilities( |
| 55 const RendererCapabilities& capabilities); | 55 const RendererCapabilities& capabilities); |
| 56 virtual void BeginMainFrameNotExpectedSoon(); | 56 virtual void BeginMainFrameNotExpectedSoon(); |
| 57 virtual void DidCommitAndDrawFrame(); | 57 virtual void DidCommitAndDrawFrame(); |
| 58 virtual void SetAnimationEvents(scoped_ptr<AnimationEvents> events); | 58 virtual void SetAnimationEvents(std::unique_ptr<AnimationEvents> events); |
| 59 virtual void DidLoseOutputSurface(); | 59 virtual void DidLoseOutputSurface(); |
| 60 virtual void RequestNewOutputSurface(); | 60 virtual void RequestNewOutputSurface(); |
| 61 virtual void DidInitializeOutputSurface( | 61 virtual void DidInitializeOutputSurface( |
| 62 bool success, | 62 bool success, |
| 63 const RendererCapabilities& capabilities); | 63 const RendererCapabilities& capabilities); |
| 64 virtual void DidCompletePageScaleAnimation(); | 64 virtual void DidCompletePageScaleAnimation(); |
| 65 virtual void PostFrameTimingEventsOnMain( | 65 virtual void PostFrameTimingEventsOnMain( |
| 66 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 66 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
| 67 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events); | 67 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> |
| 68 main_frame_events); |
| 68 virtual void BeginMainFrame( | 69 virtual void BeginMainFrame( |
| 69 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state); | 70 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state); |
| 70 | 71 |
| 71 ChannelMain* channel_main() const { return channel_main_.get(); } | 72 ChannelMain* channel_main() const { return channel_main_.get(); } |
| 72 CommitPipelineStage max_requested_pipeline_stage() const { | 73 CommitPipelineStage max_requested_pipeline_stage() const { |
| 73 return max_requested_pipeline_stage_; | 74 return max_requested_pipeline_stage_; |
| 74 } | 75 } |
| 75 CommitPipelineStage current_pipeline_stage() const { | 76 CommitPipelineStage current_pipeline_stage() const { |
| 76 return current_pipeline_stage_; | 77 return current_pipeline_stage_; |
| 77 } | 78 } |
| 78 CommitPipelineStage final_pipeline_stage() const { | 79 CommitPipelineStage final_pipeline_stage() const { |
| 79 return final_pipeline_stage_; | 80 return final_pipeline_stage_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 96 void SetNeedsAnimate() override; | 97 void SetNeedsAnimate() override; |
| 97 void SetNeedsUpdateLayers() override; | 98 void SetNeedsUpdateLayers() override; |
| 98 void SetNeedsCommit() override; | 99 void SetNeedsCommit() override; |
| 99 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; | 100 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; |
| 100 void SetNextCommitWaitsForActivation() override; | 101 void SetNextCommitWaitsForActivation() override; |
| 101 void NotifyInputThrottledUntilCommit() override; | 102 void NotifyInputThrottledUntilCommit() override; |
| 102 void SetDeferCommits(bool defer_commits) override; | 103 void SetDeferCommits(bool defer_commits) override; |
| 103 bool CommitRequested() const override; | 104 bool CommitRequested() const override; |
| 104 bool BeginMainFrameRequested() const override; | 105 bool BeginMainFrameRequested() const override; |
| 105 void MainThreadHasStoppedFlinging() override; | 106 void MainThreadHasStoppedFlinging() override; |
| 106 void Start(scoped_ptr<BeginFrameSource> external_begin_frame_source) override; | 107 void Start( |
| 108 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override; |
| 107 void Stop() override; | 109 void Stop() override; |
| 108 bool SupportsImplScrolling() const override; | 110 bool SupportsImplScrolling() const override; |
| 109 bool MainFrameWillHappenForTesting() override; | 111 bool MainFrameWillHappenForTesting() override; |
| 110 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) override; | 112 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) override; |
| 111 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) override; | 113 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) override; |
| 112 void ReleaseOutputSurface() override; | 114 void ReleaseOutputSurface() override; |
| 113 void UpdateTopControlsState(TopControlsState constraints, | 115 void UpdateTopControlsState(TopControlsState constraints, |
| 114 TopControlsState current, | 116 TopControlsState current, |
| 115 bool animate) override; | 117 bool animate) override; |
| 116 void SetOutputIsSecure(bool output_is_secure) override; | 118 void SetOutputIsSecure(bool output_is_secure) override; |
| 117 | 119 |
| 118 // This sets the channel used by ProxyMain to communicate with ProxyImpl. | 120 // This sets the channel used by ProxyMain to communicate with ProxyImpl. |
| 119 void SetChannel(scoped_ptr<ChannelMain> channel_main); | 121 void SetChannel(std::unique_ptr<ChannelMain> channel_main); |
| 120 | 122 |
| 121 // Returns |true| if the request was actually sent, |false| if one was | 123 // Returns |true| if the request was actually sent, |false| if one was |
| 122 // already outstanding. | 124 // already outstanding. |
| 123 bool SendCommitRequestToImplThreadIfNeeded( | 125 bool SendCommitRequestToImplThreadIfNeeded( |
| 124 CommitPipelineStage required_stage); | 126 CommitPipelineStage required_stage); |
| 125 bool IsMainThread() const; | 127 bool IsMainThread() const; |
| 126 | 128 |
| 127 LayerTreeHost* layer_tree_host_; | 129 LayerTreeHost* layer_tree_host_; |
| 128 | 130 |
| 129 TaskRunnerProvider* task_runner_provider_; | 131 TaskRunnerProvider* task_runner_provider_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 143 bool commit_waits_for_activation_; | 145 bool commit_waits_for_activation_; |
| 144 | 146 |
| 145 // Set when the Proxy is started using Proxy::Start() and reset when it is | 147 // Set when the Proxy is started using Proxy::Start() and reset when it is |
| 146 // stopped using Proxy::Stop(). | 148 // stopped using Proxy::Stop(). |
| 147 bool started_; | 149 bool started_; |
| 148 | 150 |
| 149 bool defer_commits_; | 151 bool defer_commits_; |
| 150 | 152 |
| 151 RendererCapabilities renderer_capabilities_; | 153 RendererCapabilities renderer_capabilities_; |
| 152 | 154 |
| 153 scoped_ptr<ChannelMain> channel_main_; | 155 std::unique_ptr<ChannelMain> channel_main_; |
| 154 | 156 |
| 155 DISALLOW_COPY_AND_ASSIGN(ProxyMain); | 157 DISALLOW_COPY_AND_ASSIGN(ProxyMain); |
| 156 }; | 158 }; |
| 157 | 159 |
| 158 } // namespace cc | 160 } // namespace cc |
| 159 | 161 |
| 160 #endif // CC_TREES_PROXY_MAIN_H_ | 162 #endif // CC_TREES_PROXY_MAIN_H_ |
| OLD | NEW |