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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class AnimationEvents; | 22 class AnimationEvents; |
23 class BeginFrameSource; | 23 class BeginFrameSource; |
24 class ContextProvider; | 24 class ContextProvider; |
25 class LayerTreeHost; | 25 class LayerTreeHost; |
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 SchedulerClient { |
31 public: | 31 public: |
32 static scoped_ptr<Proxy> Create(LayerTreeHost* layer_tree_host, | 32 static std::unique_ptr<Proxy> Create( |
33 LayerTreeHostSingleThreadClient* client, | 33 LayerTreeHost* layer_tree_host, |
34 TaskRunnerProvider* task_runner_provider_); | 34 LayerTreeHostSingleThreadClient* client, |
| 35 TaskRunnerProvider* task_runner_provider_); |
35 ~SingleThreadProxy() override; | 36 ~SingleThreadProxy() override; |
36 | 37 |
37 // Proxy implementation | 38 // Proxy implementation |
38 void FinishAllRendering() override; | 39 void FinishAllRendering() override; |
39 bool IsStarted() const override; | 40 bool IsStarted() const override; |
40 bool CommitToActiveTree() const override; | 41 bool CommitToActiveTree() const override; |
41 void SetOutputSurface(OutputSurface* output_surface) override; | 42 void SetOutputSurface(OutputSurface* output_surface) override; |
42 void ReleaseOutputSurface() override; | 43 void ReleaseOutputSurface() override; |
43 void SetVisible(bool visible) override; | 44 void SetVisible(bool visible) override; |
44 const RendererCapabilities& GetRendererCapabilities() const override; | 45 const RendererCapabilities& GetRendererCapabilities() const override; |
45 void SetNeedsAnimate() override; | 46 void SetNeedsAnimate() override; |
46 void SetNeedsUpdateLayers() override; | 47 void SetNeedsUpdateLayers() override; |
47 void SetNeedsCommit() override; | 48 void SetNeedsCommit() override; |
48 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; | 49 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; |
49 void SetNextCommitWaitsForActivation() override; | 50 void SetNextCommitWaitsForActivation() override; |
50 void NotifyInputThrottledUntilCommit() override {} | 51 void NotifyInputThrottledUntilCommit() override {} |
51 void SetDeferCommits(bool defer_commits) override; | 52 void SetDeferCommits(bool defer_commits) override; |
52 bool CommitRequested() const override; | 53 bool CommitRequested() const override; |
53 bool BeginMainFrameRequested() const override; | 54 bool BeginMainFrameRequested() const override; |
54 void MainThreadHasStoppedFlinging() override {} | 55 void MainThreadHasStoppedFlinging() override {} |
55 void Start(scoped_ptr<BeginFrameSource> external_begin_frame_source) override; | 56 void Start( |
| 57 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override; |
56 void Stop() override; | 58 void Stop() override; |
57 bool SupportsImplScrolling() const override; | 59 bool SupportsImplScrolling() const override; |
58 bool MainFrameWillHappenForTesting() override; | 60 bool MainFrameWillHappenForTesting() override; |
59 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) override; | 61 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) override; |
60 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) override; | 62 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) override; |
61 void UpdateTopControlsState(TopControlsState constraints, | 63 void UpdateTopControlsState(TopControlsState constraints, |
62 TopControlsState current, | 64 TopControlsState current, |
63 bool animate) override; | 65 bool animate) override; |
64 void SetOutputIsSecure(bool output_is_secure) override; | 66 void SetOutputIsSecure(bool output_is_secure) override; |
65 | 67 |
(...skipping 22 matching lines...) Expand all Loading... |
88 void OnCanDrawStateChanged(bool can_draw) override; | 90 void OnCanDrawStateChanged(bool can_draw) override; |
89 void NotifyReadyToActivate() override; | 91 void NotifyReadyToActivate() override; |
90 void NotifyReadyToDraw() override; | 92 void NotifyReadyToDraw() override; |
91 void SetNeedsRedrawOnImplThread() override; | 93 void SetNeedsRedrawOnImplThread() override; |
92 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override; | 94 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override; |
93 void SetNeedsOneBeginImplFrameOnImplThread() override; | 95 void SetNeedsOneBeginImplFrameOnImplThread() override; |
94 void SetNeedsPrepareTilesOnImplThread() override; | 96 void SetNeedsPrepareTilesOnImplThread() override; |
95 void SetNeedsCommitOnImplThread() override; | 97 void SetNeedsCommitOnImplThread() override; |
96 void SetVideoNeedsBeginFrames(bool needs_begin_frames) override; | 98 void SetVideoNeedsBeginFrames(bool needs_begin_frames) override; |
97 void PostAnimationEventsToMainThreadOnImplThread( | 99 void PostAnimationEventsToMainThreadOnImplThread( |
98 scoped_ptr<AnimationEvents> events) override; | 100 std::unique_ptr<AnimationEvents> events) override; |
99 bool IsInsideDraw() override; | 101 bool IsInsideDraw() override; |
100 void RenewTreePriority() override {} | 102 void RenewTreePriority() override {} |
101 void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, | 103 void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, |
102 base::TimeDelta delay) override {} | 104 base::TimeDelta delay) override {} |
103 void DidActivateSyncTree() override; | 105 void DidActivateSyncTree() override; |
104 void WillPrepareTiles() override; | 106 void WillPrepareTiles() override; |
105 void DidPrepareTiles() override; | 107 void DidPrepareTiles() override; |
106 void DidCompletePageScaleAnimationOnImplThread() override; | 108 void DidCompletePageScaleAnimationOnImplThread() override; |
107 void OnDrawForOutputSurface(bool resourceless_software_draw) override; | 109 void OnDrawForOutputSurface(bool resourceless_software_draw) override; |
108 void PostFrameTimingEventsOnImplThread( | 110 void PostFrameTimingEventsOnImplThread( |
109 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 111 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
110 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) | 112 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) |
111 override; | 113 override; |
112 | 114 |
113 void RequestNewOutputSurface(); | 115 void RequestNewOutputSurface(); |
114 | 116 |
115 // Called by the legacy path where RenderWidget does the scheduling. | 117 // Called by the legacy path where RenderWidget does the scheduling. |
116 void CompositeImmediately(base::TimeTicks frame_begin_time); | 118 void CompositeImmediately(base::TimeTicks frame_begin_time); |
117 | 119 |
118 protected: | 120 protected: |
119 SingleThreadProxy(LayerTreeHost* layer_tree_host, | 121 SingleThreadProxy(LayerTreeHost* layer_tree_host, |
120 LayerTreeHostSingleThreadClient* client, | 122 LayerTreeHostSingleThreadClient* client, |
(...skipping 13 matching lines...) Expand all Loading... |
134 void ScheduleRequestNewOutputSurface(); | 136 void ScheduleRequestNewOutputSurface(); |
135 | 137 |
136 // Accessed on main thread only. | 138 // Accessed on main thread only. |
137 LayerTreeHost* layer_tree_host_; | 139 LayerTreeHost* layer_tree_host_; |
138 LayerTreeHostSingleThreadClient* client_; | 140 LayerTreeHostSingleThreadClient* client_; |
139 | 141 |
140 TaskRunnerProvider* task_runner_provider_; | 142 TaskRunnerProvider* task_runner_provider_; |
141 | 143 |
142 // Used on the Thread, but checked on main thread during | 144 // Used on the Thread, but checked on main thread during |
143 // initialization/shutdown. | 145 // initialization/shutdown. |
144 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 146 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
145 RendererCapabilities renderer_capabilities_for_main_thread_; | 147 RendererCapabilities renderer_capabilities_for_main_thread_; |
146 | 148 |
147 // Accessed from both threads. | 149 // Accessed from both threads. |
148 scoped_ptr<BeginFrameSource> external_begin_frame_source_; | 150 std::unique_ptr<BeginFrameSource> external_begin_frame_source_; |
149 scoped_ptr<BeginFrameSource> unthrottled_begin_frame_source_; | 151 std::unique_ptr<BeginFrameSource> unthrottled_begin_frame_source_; |
150 scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_; | 152 std::unique_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_; |
151 scoped_ptr<Scheduler> scheduler_on_impl_thread_; | 153 std::unique_ptr<Scheduler> scheduler_on_impl_thread_; |
152 | 154 |
153 base::TimeDelta authoritative_vsync_interval_; | 155 base::TimeDelta authoritative_vsync_interval_; |
154 base::TimeTicks last_vsync_timebase_; | 156 base::TimeTicks last_vsync_timebase_; |
155 | 157 |
156 scoped_ptr<BlockingTaskRunner::CapturePostTasks> commit_blocking_task_runner_; | 158 std::unique_ptr<BlockingTaskRunner::CapturePostTasks> |
| 159 commit_blocking_task_runner_; |
157 bool next_frame_is_newly_committed_frame_; | 160 bool next_frame_is_newly_committed_frame_; |
158 | 161 |
159 #if DCHECK_IS_ON() | 162 #if DCHECK_IS_ON() |
160 bool inside_impl_frame_; | 163 bool inside_impl_frame_; |
161 #endif | 164 #endif |
162 bool inside_draw_; | 165 bool inside_draw_; |
163 bool defer_commits_; | 166 bool defer_commits_; |
164 bool animate_requested_; | 167 bool animate_requested_; |
165 bool commit_requested_; | 168 bool commit_requested_; |
166 bool inside_synchronous_composite_; | 169 bool inside_synchronous_composite_; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 private: | 241 private: |
239 DebugScopedSetImplThread impl_thread_; | 242 DebugScopedSetImplThread impl_thread_; |
240 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 243 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
241 | 244 |
242 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 245 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
243 }; | 246 }; |
244 | 247 |
245 } // namespace cc | 248 } // namespace cc |
246 | 249 |
247 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 250 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
OLD | NEW |