Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: cc/trees/single_thread_proxy.h

Issue 508373002: cc: Single-threaded impl-side painting for unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: danakj review Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/time/time.h" 10 #include "base/time/time.h"
11 #include "cc/animation/animation_events.h" 11 #include "cc/animation/animation_events.h"
12 #include "cc/output/begin_frame_args.h" 12 #include "cc/output/begin_frame_args.h"
13 #include "cc/scheduler/scheduler.h" 13 #include "cc/scheduler/scheduler.h"
14 #include "cc/trees/blocking_task_runner.h"
14 #include "cc/trees/layer_tree_host_impl.h" 15 #include "cc/trees/layer_tree_host_impl.h"
15 #include "cc/trees/proxy.h" 16 #include "cc/trees/proxy.h"
16 #include "cc/trees/proxy_timing_history.h" 17 #include "cc/trees/proxy_timing_history.h"
17 18
18 namespace cc { 19 namespace cc {
19 20
20 class ContextProvider; 21 class ContextProvider;
21 class LayerTreeHost; 22 class LayerTreeHost;
22 class LayerTreeHostSingleThreadClient; 23 class LayerTreeHostSingleThreadClient;
23 24
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 virtual void PostAnimationEventsToMainThreadOnImplThread( 96 virtual void PostAnimationEventsToMainThreadOnImplThread(
96 scoped_ptr<AnimationEventsVector> events) OVERRIDE; 97 scoped_ptr<AnimationEventsVector> events) OVERRIDE;
97 virtual bool ReduceContentsTextureMemoryOnImplThread( 98 virtual bool ReduceContentsTextureMemoryOnImplThread(
98 size_t limit_bytes, 99 size_t limit_bytes,
99 int priority_cutoff) OVERRIDE; 100 int priority_cutoff) OVERRIDE;
100 virtual bool IsInsideDraw() OVERRIDE; 101 virtual bool IsInsideDraw() OVERRIDE;
101 virtual void RenewTreePriority() OVERRIDE {} 102 virtual void RenewTreePriority() OVERRIDE {}
102 virtual void PostDelayedScrollbarFadeOnImplThread( 103 virtual void PostDelayedScrollbarFadeOnImplThread(
103 const base::Closure& start_fade, 104 const base::Closure& start_fade,
104 base::TimeDelta delay) OVERRIDE {} 105 base::TimeDelta delay) OVERRIDE {}
105 virtual void DidActivateSyncTree() OVERRIDE {} 106 virtual void DidActivateSyncTree() OVERRIDE;
106 virtual void DidManageTiles() OVERRIDE; 107 virtual void DidManageTiles() OVERRIDE;
107 virtual void SetDebugState(const LayerTreeDebugState& debug_state) OVERRIDE {} 108 virtual void SetDebugState(const LayerTreeDebugState& debug_state) OVERRIDE {}
108 109
109 // Attempts to create the context and renderer synchronously. Calls 110 // Attempts to create the context and renderer synchronously. Calls
110 // LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted with the result. 111 // LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted with the result.
111 void CreateAndInitializeOutputSurface(); 112 void CreateAndInitializeOutputSurface();
112 113
113 // Called by the legacy path where RenderWidget does the scheduling. 114 // Called by the legacy path where RenderWidget does the scheduling.
114 void CompositeImmediately(base::TimeTicks frame_begin_time); 115 void CompositeImmediately(base::TimeTicks frame_begin_time);
115 116
116 private: 117 private:
117 SingleThreadProxy( 118 SingleThreadProxy(
118 LayerTreeHost* layer_tree_host, 119 LayerTreeHost* layer_tree_host,
119 LayerTreeHostSingleThreadClient* client, 120 LayerTreeHostSingleThreadClient* client,
120 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); 121 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner);
121 122
122 void BeginMainFrame(); 123 void BeginMainFrame();
123 void BeginMainFrameAbortedOnImplThread(); 124 void BeginMainFrameAbortedOnImplThread();
124 void DoCommit(const BeginFrameArgs& begin_frame_args); 125 void DoCommit(const BeginFrameArgs& begin_frame_args);
125 DrawResult DoComposite(base::TimeTicks frame_begin_time, 126 DrawResult DoComposite(base::TimeTicks frame_begin_time,
126 LayerTreeHostImpl::FrameData* frame); 127 LayerTreeHostImpl::FrameData* frame);
127 void DoSwap(); 128 void DoSwap();
128 void DidCommitAndDrawFrame(); 129 void DidCommitAndDrawFrame();
130 void CommitComplete();
129 131
130 bool ShouldComposite() const; 132 bool ShouldComposite() const;
131 void UpdateBackgroundAnimateTicking(); 133 void UpdateBackgroundAnimateTicking();
132 134
133 // Accessed on main thread only. 135 // Accessed on main thread only.
134 LayerTreeHost* layer_tree_host_; 136 LayerTreeHost* layer_tree_host_;
135 LayerTreeHostSingleThreadClient* client_; 137 LayerTreeHostSingleThreadClient* client_;
136 138
137 // Used on the Thread, but checked on main thread during 139 // Used on the Thread, but checked on main thread during
138 // initialization/shutdown. 140 // initialization/shutdown.
139 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; 141 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_;
140 RendererCapabilities renderer_capabilities_for_main_thread_; 142 RendererCapabilities renderer_capabilities_for_main_thread_;
141 143
142 // Accessed from both threads. 144 // Accessed from both threads.
143 scoped_ptr<Scheduler> scheduler_on_impl_thread_; 145 scoped_ptr<Scheduler> scheduler_on_impl_thread_;
144 ProxyTimingHistory timing_history_; 146 ProxyTimingHistory timing_history_;
145 147
148 scoped_ptr<BlockingTaskRunner::CapturePostTasks> commit_blocking_task_runner_;
146 bool next_frame_is_newly_committed_frame_; 149 bool next_frame_is_newly_committed_frame_;
147 150
148 bool inside_draw_; 151 bool inside_draw_;
149 bool defer_commits_; 152 bool defer_commits_;
150 bool commit_was_deferred_; 153 bool commit_was_deferred_;
151 bool commit_requested_; 154 bool commit_requested_;
152 155
153 base::WeakPtrFactory<SingleThreadProxy> weak_factory_; 156 base::WeakPtrFactory<SingleThreadProxy> weak_factory_;
154 157
155 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy); 158 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 private: 215 private:
213 DebugScopedSetImplThread impl_thread_; 216 DebugScopedSetImplThread impl_thread_;
214 DebugScopedSetMainThreadBlocked main_thread_blocked_; 217 DebugScopedSetMainThreadBlocked main_thread_blocked_;
215 218
216 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); 219 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked);
217 }; 220 };
218 221
219 } // namespace cc 222 } // namespace cc
220 223
221 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ 224 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698