| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_SINGLE_THREAD_PROXY_H_ | 5 #ifndef CC_TREES_SINGLE_THREAD_PROXY_H_ |
| 6 #define CC_TREES_SINGLE_THREAD_PROXY_H_ | 6 #define CC_TREES_SINGLE_THREAD_PROXY_H_ |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "cc/output/begin_frame_args.h" | 13 #include "cc/output/begin_frame_args.h" |
| 14 #include "cc/scheduler/scheduler.h" | 14 #include "cc/scheduler/scheduler.h" |
| 15 #include "cc/trees/blocking_task_runner.h" | 15 #include "cc/trees/blocking_task_runner.h" |
| 16 #include "cc/trees/layer_tree_host_impl.h" | 16 #include "cc/trees/layer_tree_host_impl.h" |
| 17 #include "cc/trees/proxy.h" | 17 #include "cc/trees/proxy.h" |
| 18 #include "cc/trees/task_runner_provider.h" | 18 #include "cc/trees/task_runner_provider.h" |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 class AnimationEvents; | 22 class AnimationEvents; |
| 23 class BeginFrameSource; | 23 class BeginFrameSource; |
| 24 class ContextProvider; | 24 class ContextProvider; |
| 25 class LayerTreeHostInProcess; | 25 class LayerTreeHostInProcess; |
| 26 class LayerTreeHostSingleThreadClient; | 26 class LayerTreeHostSingleThreadClient; |
| 27 | 27 |
| 28 class CC_EXPORT SingleThreadProxy : public Proxy, | 28 class CC_EXPORT SingleThreadProxy : public Proxy, |
| 29 NON_EXPORTED_BASE(LayerTreeHostImplClient), | 29 NON_EXPORTED_BASE(LayerTreeHostImplClient), |
| 30 SchedulerClient { | 30 public SchedulerClient { |
| 31 public: | 31 public: |
| 32 static std::unique_ptr<Proxy> Create( | 32 static std::unique_ptr<Proxy> Create( |
| 33 LayerTreeHostInProcess* layer_tree_host, | 33 LayerTreeHostInProcess* layer_tree_host, |
| 34 LayerTreeHostSingleThreadClient* client, | 34 LayerTreeHostSingleThreadClient* client, |
| 35 TaskRunnerProvider* task_runner_provider_); | 35 TaskRunnerProvider* task_runner_provider_); |
| 36 ~SingleThreadProxy() override; | 36 ~SingleThreadProxy() override; |
| 37 | 37 |
| 38 // Proxy implementation | 38 // Proxy implementation |
| 39 bool IsStarted() const override; | 39 bool IsStarted() const override; |
| 40 bool CommitToActiveTree() const override; | 40 bool CommitToActiveTree() const override; |
| 41 void SetCompositorFrameSink( | 41 void SetCompositorFrameSink( |
| 42 CompositorFrameSink* compositor_frame_sink) override; | 42 CompositorFrameSink* compositor_frame_sink) override; |
| 43 void ReleaseCompositorFrameSink() override; | 43 void ReleaseCompositorFrameSink() override; |
| 44 void SetVisible(bool visible) override; | 44 void SetVisible(bool visible) override; |
| 45 void SetNeedsAnimate() override; | 45 void SetNeedsAnimate() override; |
| 46 void SetNeedsUpdateLayers() override; | 46 void SetNeedsUpdateLayers() override; |
| 47 void SetNeedsCommit() override; | 47 void SetNeedsCommit() override; |
| 48 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; | 48 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; |
| 49 void SetNextCommitWaitsForActivation() override; | 49 void SetNextCommitWaitsForActivation() override; |
| 50 void NotifyInputThrottledUntilCommit() override {} | 50 void NotifyInputThrottledUntilCommit() override {} |
| 51 void SetDeferCommits(bool defer_commits) override; | 51 void SetDeferCommits(bool defer_commits) override; |
| 52 bool CommitRequested() const override; | 52 bool CommitRequested() const override; |
| 53 bool BeginMainFrameRequested() const override; | 53 bool BeginMainFrameRequested() const override; |
| 54 void MainThreadHasStoppedFlinging() override {} | 54 void MainThreadHasStoppedFlinging() override {} |
| 55 void Start( | 55 void Start() override; |
| 56 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override; | |
| 57 void Stop() override; | 56 void Stop() override; |
| 58 void SetMutator(std::unique_ptr<LayerTreeMutator> mutator) override; | 57 void SetMutator(std::unique_ptr<LayerTreeMutator> mutator) override; |
| 59 bool SupportsImplScrolling() const override; | 58 bool SupportsImplScrolling() const override; |
| 60 bool MainFrameWillHappenForTesting() override; | 59 bool MainFrameWillHappenForTesting() override; |
| 61 void UpdateTopControlsState(TopControlsState constraints, | 60 void UpdateTopControlsState(TopControlsState constraints, |
| 62 TopControlsState current, | 61 TopControlsState current, |
| 63 bool animate) override; | 62 bool animate) override; |
| 64 | 63 |
| 65 // SchedulerClient implementation | 64 // SchedulerClient implementation |
| 66 void WillBeginImplFrame(const BeginFrameArgs& args) override; | 65 void WillBeginImplFrame(const BeginFrameArgs& args) override; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 LayerTreeHostInProcess* layer_tree_host_; | 126 LayerTreeHostInProcess* layer_tree_host_; |
| 128 LayerTreeHostSingleThreadClient* client_; | 127 LayerTreeHostSingleThreadClient* client_; |
| 129 | 128 |
| 130 TaskRunnerProvider* task_runner_provider_; | 129 TaskRunnerProvider* task_runner_provider_; |
| 131 | 130 |
| 132 // Used on the Thread, but checked on main thread during | 131 // Used on the Thread, but checked on main thread during |
| 133 // initialization/shutdown. | 132 // initialization/shutdown. |
| 134 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 133 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
| 135 | 134 |
| 136 // Accessed from both threads. | 135 // Accessed from both threads. |
| 137 std::unique_ptr<BeginFrameSource> external_begin_frame_source_; | |
| 138 std::unique_ptr<Scheduler> scheduler_on_impl_thread_; | 136 std::unique_ptr<Scheduler> scheduler_on_impl_thread_; |
| 139 | 137 |
| 140 std::unique_ptr<BlockingTaskRunner::CapturePostTasks> | 138 std::unique_ptr<BlockingTaskRunner::CapturePostTasks> |
| 141 commit_blocking_task_runner_; | 139 commit_blocking_task_runner_; |
| 142 bool next_frame_is_newly_committed_frame_; | 140 bool next_frame_is_newly_committed_frame_; |
| 143 | 141 |
| 144 #if DCHECK_IS_ON() | 142 #if DCHECK_IS_ON() |
| 145 bool inside_impl_frame_; | 143 bool inside_impl_frame_; |
| 146 #endif | 144 #endif |
| 147 bool inside_draw_; | 145 bool inside_draw_; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 private: | 234 private: |
| 237 DebugScopedSetImplThread impl_thread_; | 235 DebugScopedSetImplThread impl_thread_; |
| 238 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 236 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
| 239 | 237 |
| 240 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 238 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
| 241 }; | 239 }; |
| 242 | 240 |
| 243 } // namespace cc | 241 } // namespace cc |
| 244 | 242 |
| 245 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 243 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
| OLD | NEW |