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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 LayerTreeHostInProcess* layer_tree_host_; | 125 LayerTreeHostInProcess* layer_tree_host_; |
127 LayerTreeHostSingleThreadClient* client_; | 126 LayerTreeHostSingleThreadClient* client_; |
128 | 127 |
129 TaskRunnerProvider* task_runner_provider_; | 128 TaskRunnerProvider* task_runner_provider_; |
130 | 129 |
131 // Used on the Thread, but checked on main thread during | 130 // Used on the Thread, but checked on main thread during |
132 // initialization/shutdown. | 131 // initialization/shutdown. |
133 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 132 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
134 | 133 |
135 // Accessed from both threads. | 134 // Accessed from both threads. |
136 std::unique_ptr<BeginFrameSource> external_begin_frame_source_; | |
137 std::unique_ptr<Scheduler> scheduler_on_impl_thread_; | 135 std::unique_ptr<Scheduler> scheduler_on_impl_thread_; |
138 | 136 |
139 std::unique_ptr<BlockingTaskRunner::CapturePostTasks> | 137 std::unique_ptr<BlockingTaskRunner::CapturePostTasks> |
140 commit_blocking_task_runner_; | 138 commit_blocking_task_runner_; |
141 bool next_frame_is_newly_committed_frame_; | 139 bool next_frame_is_newly_committed_frame_; |
142 | 140 |
143 #if DCHECK_IS_ON() | 141 #if DCHECK_IS_ON() |
144 bool inside_impl_frame_; | 142 bool inside_impl_frame_; |
145 #endif | 143 #endif |
146 bool inside_draw_; | 144 bool inside_draw_; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 private: | 233 private: |
236 DebugScopedSetImplThread impl_thread_; | 234 DebugScopedSetImplThread impl_thread_; |
237 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 235 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
238 | 236 |
239 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 237 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
240 }; | 238 }; |
241 | 239 |
242 } // namespace cc | 240 } // namespace cc |
243 | 241 |
244 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 242 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
OLD | NEW |