| 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 "base/memory/weak_ptr.h" |
| 11 #include "cc/base/completion_event.h" | 12 #include "cc/base/completion_event.h" |
| 12 #include "cc/base/delayed_unique_notifier.h" | 13 #include "cc/base/delayed_unique_notifier.h" |
| 13 #include "cc/input/browser_controls_state.h" | 14 #include "cc/input/browser_controls_state.h" |
| 14 #include "cc/scheduler/scheduler.h" | 15 #include "cc/scheduler/scheduler.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 class LayerTreeHostInProcess; |
| 20 class ProxyMain; |
| 20 | 21 |
| 21 // This class aggregates all the interactions that the main side of the | 22 // This class aggregates all the interactions that the main side of the |
| 22 // compositor needs to have with the impl side. It is created and owned by the | 23 // compositor needs to have with the impl side. |
| 23 // ChannelImpl implementation. The class lives entirely on the impl thread. | 24 // The class is created and lives on the impl thread. |
| 24 class CC_EXPORT ProxyImpl : public NON_EXPORTED_BASE(LayerTreeHostImplClient), | 25 class CC_EXPORT ProxyImpl : public NON_EXPORTED_BASE(LayerTreeHostImplClient), |
| 25 public NON_EXPORTED_BASE(SchedulerClient) { | 26 public NON_EXPORTED_BASE(SchedulerClient) { |
| 26 public: | 27 public: |
| 27 ProxyImpl(ChannelImpl* channel_impl, | 28 ProxyImpl(base::WeakPtr<ProxyMain> proxy_main_weak_ptr, |
| 28 LayerTreeHostInProcess* layer_tree_host, | 29 LayerTreeHostInProcess* layer_tree_host, |
| 29 TaskRunnerProvider* task_runner_provider); | 30 TaskRunnerProvider* task_runner_provider); |
| 30 ~ProxyImpl() override; | 31 ~ProxyImpl() override; |
| 31 | 32 |
| 32 // Virtual for testing. | |
| 33 void UpdateBrowserControlsStateOnImpl(BrowserControlsState constraints, | 33 void UpdateBrowserControlsStateOnImpl(BrowserControlsState constraints, |
| 34 BrowserControlsState current, | 34 BrowserControlsState current, |
| 35 bool animate); | 35 bool animate); |
| 36 void InitializeCompositorFrameSinkOnImpl( | 36 void InitializeCompositorFrameSinkOnImpl( |
| 37 CompositorFrameSink* compositor_frame_sink); | 37 CompositorFrameSink* compositor_frame_sink); |
| 38 void InitializeMutatorOnImpl(std::unique_ptr<LayerTreeMutator> mutator); | 38 void InitializeMutatorOnImpl(std::unique_ptr<LayerTreeMutator> mutator); |
| 39 void MainThreadHasStoppedFlingingOnImpl(); | 39 void MainThreadHasStoppedFlingingOnImpl(); |
| 40 void SetInputThrottledUntilCommitOnImpl(bool is_throttled); | 40 void SetInputThrottledUntilCommitOnImpl(bool is_throttled); |
| 41 void SetDeferCommitsOnImpl(bool defer_commits) const; | 41 void SetDeferCommitsOnImpl(bool defer_commits) const; |
| 42 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect); | 42 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void ScheduledActionActivateSyncTree() override; | 101 void ScheduledActionActivateSyncTree() override; |
| 102 void ScheduledActionBeginCompositorFrameSinkCreation() override; | 102 void ScheduledActionBeginCompositorFrameSinkCreation() override; |
| 103 void ScheduledActionPrepareTiles() override; | 103 void ScheduledActionPrepareTiles() override; |
| 104 void ScheduledActionInvalidateCompositorFrameSink() override; | 104 void ScheduledActionInvalidateCompositorFrameSink() override; |
| 105 void SendBeginMainFrameNotExpectedSoon() override; | 105 void SendBeginMainFrameNotExpectedSoon() override; |
| 106 | 106 |
| 107 DrawResult DrawInternal(bool forced_draw); | 107 DrawResult DrawInternal(bool forced_draw); |
| 108 | 108 |
| 109 bool IsImplThread() const; | 109 bool IsImplThread() const; |
| 110 bool IsMainThreadBlocked() const; | 110 bool IsMainThreadBlocked() const; |
| 111 base::SingleThreadTaskRunner* MainThreadTaskRunner(); |
| 111 | 112 |
| 112 const int layer_tree_host_id_; | 113 const int layer_tree_host_id_; |
| 113 | 114 |
| 114 std::unique_ptr<Scheduler> scheduler_; | 115 std::unique_ptr<Scheduler> scheduler_; |
| 115 | 116 |
| 116 // Set when the main thread is waiting on a pending tree activation. | 117 // Set when the main thread is waiting on a pending tree activation. |
| 117 bool commit_completion_waits_for_activation_; | 118 bool commit_completion_waits_for_activation_; |
| 118 | 119 |
| 119 // Set when the main thread is waiting on a commit to complete. | 120 // Set when the main thread is waiting on a commit to complete. |
| 120 CompletionEvent* commit_completion_event_; | 121 CompletionEvent* commit_completion_event_; |
| 121 | 122 |
| 122 // Set when the main thread is waiting for activation to complete. | 123 // Set when the main thread is waiting for activation to complete. |
| 123 CompletionEvent* activation_completion_event_; | 124 CompletionEvent* activation_completion_event_; |
| 124 | 125 |
| 125 // Set when the next draw should post DidCommitAndDrawFrame to the main | 126 // Set when the next draw should post DidCommitAndDrawFrame to the main |
| 126 // thread. | 127 // thread. |
| 127 bool next_frame_is_newly_committed_frame_; | 128 bool next_frame_is_newly_committed_frame_; |
| 128 | 129 |
| 129 bool inside_draw_; | 130 bool inside_draw_; |
| 130 bool input_throttled_until_commit_; | 131 bool input_throttled_until_commit_; |
| 131 | 132 |
| 132 TaskRunnerProvider* task_runner_provider_; | 133 TaskRunnerProvider* task_runner_provider_; |
| 133 | 134 |
| 134 DelayedUniqueNotifier smoothness_priority_expiration_notifier_; | 135 DelayedUniqueNotifier smoothness_priority_expiration_notifier_; |
| 135 | 136 |
| 136 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 137 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
| 137 | 138 |
| 138 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 139 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
| 139 | 140 |
| 140 ChannelImpl* channel_impl_; | |
| 141 | |
| 142 // Use accessors instead of this variable directly. | 141 // Use accessors instead of this variable directly. |
| 143 BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_; | 142 BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_; |
| 144 BlockedMainCommitOnly& blocked_main_commit(); | 143 BlockedMainCommitOnly& blocked_main_commit(); |
| 145 | 144 |
| 145 // Used to post tasks to ProxyMain on the main thread. |
| 146 base::WeakPtr<ProxyMain> proxy_main_weak_ptr_; |
| 147 |
| 146 DISALLOW_COPY_AND_ASSIGN(ProxyImpl); | 148 DISALLOW_COPY_AND_ASSIGN(ProxyImpl); |
| 147 }; | 149 }; |
| 148 | 150 |
| 149 } // namespace cc | 151 } // namespace cc |
| 150 | 152 |
| 151 #endif // CC_TREES_PROXY_IMPL_H_ | 153 #endif // CC_TREES_PROXY_IMPL_H_ |
| OLD | NEW |