| 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_IMPL_H_ | 5 #ifndef CC_TREES_PROXY_IMPL_H_ |
| 6 #define CC_TREES_PROXY_IMPL_H_ | 6 #define CC_TREES_PROXY_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "cc/base/completion_event.h" | 11 #include "cc/base/completion_event.h" |
| 12 #include "cc/base/delayed_unique_notifier.h" | 12 #include "cc/base/delayed_unique_notifier.h" |
| 13 #include "cc/input/top_controls_state.h" | 13 #include "cc/input/top_controls_state.h" |
| 14 #include "cc/scheduler/scheduler.h" | 14 #include "cc/scheduler/scheduler.h" |
| 15 #include "cc/trees/channel_impl.h" | 15 #include "cc/trees/channel_impl.h" |
| 16 #include "cc/trees/layer_tree_host_impl.h" | 16 #include "cc/trees/layer_tree_host_impl.h" |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 class LayerTreeHostInProcess; |
| 19 | 20 |
| 20 // This class aggregates all the interactions that the main side of the | 21 // This class aggregates all the interactions that the main side of the |
| 21 // compositor needs to have with the impl side. It is created and owned by the | 22 // compositor needs to have with the impl side. It is created and owned by the |
| 22 // ChannelImpl implementation. The class lives entirely on the impl thread. | 23 // ChannelImpl implementation. The class lives entirely on the impl thread. |
| 23 class CC_EXPORT ProxyImpl : public NON_EXPORTED_BASE(LayerTreeHostImplClient), | 24 class CC_EXPORT ProxyImpl : public NON_EXPORTED_BASE(LayerTreeHostImplClient), |
| 24 public NON_EXPORTED_BASE(SchedulerClient) { | 25 public NON_EXPORTED_BASE(SchedulerClient) { |
| 25 public: | 26 public: |
| 26 ProxyImpl(ChannelImpl* channel_impl, | 27 ProxyImpl(ChannelImpl* channel_impl, |
| 27 LayerTreeHost* layer_tree_host, | 28 LayerTreeHostInProcess* layer_tree_host, |
| 28 TaskRunnerProvider* task_runner_provider, | 29 TaskRunnerProvider* task_runner_provider, |
| 29 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | 30 std::unique_ptr<BeginFrameSource> external_begin_frame_source); |
| 30 ~ProxyImpl() override; | 31 ~ProxyImpl() override; |
| 31 | 32 |
| 32 // Virtual for testing. | 33 // Virtual for testing. |
| 33 void UpdateTopControlsStateOnImpl(TopControlsState constraints, | 34 void UpdateTopControlsStateOnImpl(TopControlsState constraints, |
| 34 TopControlsState current, | 35 TopControlsState current, |
| 35 bool animate); | 36 bool animate); |
| 36 void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface); | 37 void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface); |
| 37 void InitializeMutatorOnImpl(std::unique_ptr<LayerTreeMutator> mutator); | 38 void InitializeMutatorOnImpl(std::unique_ptr<LayerTreeMutator> mutator); |
| 38 void MainThreadHasStoppedFlingingOnImpl(); | 39 void MainThreadHasStoppedFlingingOnImpl(); |
| 39 void SetInputThrottledUntilCommitOnImpl(bool is_throttled); | 40 void SetInputThrottledUntilCommitOnImpl(bool is_throttled); |
| 40 void SetDeferCommitsOnImpl(bool defer_commits) const; | 41 void SetDeferCommitsOnImpl(bool defer_commits) const; |
| 41 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect); | 42 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect); |
| 42 void SetNeedsCommitOnImpl(); | 43 void SetNeedsCommitOnImpl(); |
| 43 void BeginMainFrameAbortedOnImpl( | 44 void BeginMainFrameAbortedOnImpl( |
| 44 CommitEarlyOutReason reason, | 45 CommitEarlyOutReason reason, |
| 45 base::TimeTicks main_thread_start_time, | 46 base::TimeTicks main_thread_start_time, |
| 46 std::vector<std::unique_ptr<SwapPromise>> swap_promises); | 47 std::vector<std::unique_ptr<SwapPromise>> swap_promises); |
| 47 void SetVisibleOnImpl(bool visible); | 48 void SetVisibleOnImpl(bool visible); |
| 48 void ReleaseOutputSurfaceOnImpl(CompletionEvent* completion); | 49 void ReleaseOutputSurfaceOnImpl(CompletionEvent* completion); |
| 49 void FinishGLOnImpl(CompletionEvent* completion); | 50 void FinishGLOnImpl(CompletionEvent* completion); |
| 50 void NotifyReadyToCommitOnImpl(CompletionEvent* completion, | 51 void NotifyReadyToCommitOnImpl(CompletionEvent* completion, |
| 51 LayerTreeHost* layer_tree_host, | 52 LayerTreeHostInProcess* layer_tree_host, |
| 52 base::TimeTicks main_thread_start_time, | 53 base::TimeTicks main_thread_start_time, |
| 53 bool hold_commit_for_activation); | 54 bool hold_commit_for_activation); |
| 54 | 55 |
| 55 void MainFrameWillHappenOnImplForTesting(CompletionEvent* completion, | 56 void MainFrameWillHappenOnImplForTesting(CompletionEvent* completion, |
| 56 bool* main_frame_will_happen); | 57 bool* main_frame_will_happen); |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 // The members of this struct should be accessed on the impl thread only when | 60 // The members of this struct should be accessed on the impl thread only when |
| 60 // the main thread is blocked for a commit. | 61 // the main thread is blocked for a commit. |
| 61 struct BlockedMainCommitOnly { | 62 struct BlockedMainCommitOnly { |
| 62 BlockedMainCommitOnly(); | 63 BlockedMainCommitOnly(); |
| 63 ~BlockedMainCommitOnly(); | 64 ~BlockedMainCommitOnly(); |
| 64 LayerTreeHost* layer_tree_host; | 65 LayerTreeHostInProcess* layer_tree_host; |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 // LayerTreeHostImplClient implementation | 68 // LayerTreeHostImplClient implementation |
| 68 void DidLoseOutputSurfaceOnImplThread() override; | 69 void DidLoseOutputSurfaceOnImplThread() override; |
| 69 void SetBeginFrameSource(BeginFrameSource* source) override; | 70 void SetBeginFrameSource(BeginFrameSource* source) override; |
| 70 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override; | 71 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override; |
| 71 void DidSwapBuffersCompleteOnImplThread() override; | 72 void DidSwapBuffersCompleteOnImplThread() override; |
| 72 void OnCanDrawStateChanged(bool can_draw) override; | 73 void OnCanDrawStateChanged(bool can_draw) override; |
| 73 void NotifyReadyToActivate() override; | 74 void NotifyReadyToActivate() override; |
| 74 void NotifyReadyToDraw() override; | 75 void NotifyReadyToDraw() override; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Use accessors instead of this variable directly. | 147 // Use accessors instead of this variable directly. |
| 147 BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_; | 148 BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_; |
| 148 BlockedMainCommitOnly& blocked_main_commit(); | 149 BlockedMainCommitOnly& blocked_main_commit(); |
| 149 | 150 |
| 150 DISALLOW_COPY_AND_ASSIGN(ProxyImpl); | 151 DISALLOW_COPY_AND_ASSIGN(ProxyImpl); |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 } // namespace cc | 154 } // namespace cc |
| 154 | 155 |
| 155 #endif // CC_TREES_PROXY_IMPL_H_ | 156 #endif // CC_TREES_PROXY_IMPL_H_ |
| OLD | NEW |