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

Side by Side Diff: cc/trees/threaded_channel.cc

Issue 1377063003: Split ThreadProxy methods to ProxyMain and ProxyImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep ProxyMain and ProxyImpl methods private. Created 5 years, 1 month 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
« no previous file with comments | « cc/trees/threaded_channel.h ('k') | cc/trees/threaded_channel_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "cc/trees/threaded_channel.h" 5 #include "cc/trees/threaded_channel.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 scoped_ptr<ThreadedChannel> ThreadedChannel::Create( 13 scoped_ptr<ThreadedChannel> ThreadedChannel::Create(
14 ThreadProxy* thread_proxy, 14 ThreadProxy* thread_proxy,
15 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 15 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
16 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 16 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
17 return make_scoped_ptr( 17 return make_scoped_ptr(
18 new ThreadedChannel(thread_proxy, main_task_runner, impl_task_runner)); 18 new ThreadedChannel(thread_proxy, main_task_runner, impl_task_runner));
19 } 19 }
20 20
21 ThreadedChannel::ThreadedChannel( 21 ThreadedChannel::ThreadedChannel(
22 ThreadProxy* thread_proxy, 22 ThreadProxy* thread_proxy,
23 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 23 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
24 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) 24 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
25 : proxy_main_(thread_proxy), 25 : proxy_main_(thread_proxy),
26 proxy_impl_(thread_proxy), 26 proxy_impl_(thread_proxy),
27 proxy_(thread_proxy),
27 main_task_runner_(main_task_runner), 28 main_task_runner_(main_task_runner),
28 impl_task_runner_(impl_task_runner) {} 29 impl_task_runner_(impl_task_runner) {}
29 30
30 void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) { 31 void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) {
31 ImplThreadTaskRunner()->PostTask( 32 ImplThreadTaskRunner()->PostTask(
32 FROM_HERE, base::Bind(&ProxyImpl::SetThrottleFrameProductionOnImpl, 33 FROM_HERE, base::Bind(&ProxyImpl::SetThrottleFrameProductionOnImpl,
33 proxy_impl_->GetImplWeakPtr(), throttle)); 34 proxy_impl_->GetImplWeakPtr(), throttle));
34 } 35 }
35 36
36 void ThreadedChannel::UpdateTopControlsStateOnImpl(TopControlsState constraints, 37 void ThreadedChannel::UpdateTopControlsStateOnImpl(TopControlsState constraints,
37 TopControlsState current, 38 TopControlsState current,
38 bool animate) { 39 bool animate) {
39 ImplThreadTaskRunner()->PostTask( 40 ImplThreadTaskRunner()->PostTask(
40 FROM_HERE, 41 FROM_HERE,
41 base::Bind(&ProxyImpl::UpdateTopControlsStateOnImpl, 42 base::Bind(&ProxyImpl::UpdateTopControlsStateOnImpl,
42 proxy_impl_->GetImplWeakPtr(), constraints, current, animate)); 43 proxy_impl_->GetImplWeakPtr(), constraints, current, animate));
43 } 44 }
44 45
46 void ThreadedChannel::InitializeOutputSurfaceOnImpl(
47 OutputSurface* output_surface) {
48 ImplThreadTaskRunner()->PostTask(
49 FROM_HERE, base::Bind(&ProxyImpl::InitializeOutputSurfaceOnImpl,
50 proxy_impl_->GetImplWeakPtr(), output_surface));
51 }
52
53 void ThreadedChannel::MainThreadHasStoppedFlingingOnImpl() {
54 ImplThreadTaskRunner()->PostTask(
55 FROM_HERE, base::Bind(&ProxyImpl::MainThreadHasStoppedFlingingOnImpl,
56 proxy_impl_->GetImplWeakPtr()));
57 }
58
59 void ThreadedChannel::SetInputThrottledUntilCommitOnImpl(bool is_throttled) {
60 ImplThreadTaskRunner()->PostTask(
61 FROM_HERE, base::Bind(&ProxyImpl::SetInputThrottledUntilCommitOnImpl,
62 proxy_impl_->GetImplWeakPtr(), is_throttled));
63 }
64
65 void ThreadedChannel::SetDeferCommitsOnImpl(bool defer_commits) {
66 ImplThreadTaskRunner()->PostTask(
67 FROM_HERE, base::Bind(&ProxyImpl::SetDeferCommitsOnImpl,
68 proxy_impl_->GetImplWeakPtr(), defer_commits));
69 }
70
71 void ThreadedChannel::FinishAllRenderingOnImpl(CompletionEvent* completion) {
72 ImplThreadTaskRunner()->PostTask(
73 FROM_HERE, base::Bind(&ProxyImpl::FinishAllRenderingOnImpl,
74 proxy_impl_->GetImplWeakPtr(), completion));
75 }
76
77 void ThreadedChannel::SetNeedsCommitOnImpl() {
78 ImplThreadTaskRunner()->PostTask(FROM_HERE,
79 base::Bind(&ProxyImpl::SetNeedsCommitOnImpl,
80 proxy_impl_->GetImplWeakPtr()));
81 }
82
83 void ThreadedChannel::BeginMainFrameAbortedOnImpl(CommitEarlyOutReason reason) {
84 ImplThreadTaskRunner()->PostTask(
85 FROM_HERE, base::Bind(&ProxyImpl::BeginMainFrameAbortedOnImpl,
86 proxy_impl_->GetImplWeakPtr(), reason));
87 }
88
89 void ThreadedChannel::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) {
90 ImplThreadTaskRunner()->PostTask(
91 FROM_HERE, base::Bind(&ProxyImpl::SetNeedsRedrawOnImpl,
92 proxy_impl_->GetImplWeakPtr(), damage_rect));
93 }
94
95 void ThreadedChannel::StartCommitOnImpl(CompletionEvent* completion) {
96 ImplThreadTaskRunner()->PostTask(
97 FROM_HERE, base::Bind(&ProxyImpl::StartCommitOnImpl,
98 proxy_impl_->GetImplWeakPtr(), completion));
99 }
100
101 void ThreadedChannel::SetVisibleOnImpl(CompletionEvent* completion,
102 bool visible) {
103 ImplThreadTaskRunner()->PostTask(
104 FROM_HERE,
105 base::Bind(&ProxyImpl::SetVisibleOnImpl, proxy_impl_->GetImplWeakPtr(),
106 completion, visible));
107 }
108
109 void ThreadedChannel::ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) {
110 ImplThreadTaskRunner()->PostTask(
111 FROM_HERE, base::Bind(&ProxyImpl::ReleaseOutputSurfaceOnImpl,
112 proxy_impl_->GetImplWeakPtr(), completion));
113 }
114
115 void ThreadedChannel::FinishGLOnImpl(CompletionEvent* completion) {
116 ImplThreadTaskRunner()->PostTask(
117 FROM_HERE, base::Bind(&ProxyImpl::FinishGLOnImpl,
118 proxy_impl_->GetImplWeakPtr(), completion));
119 }
120
121 void ThreadedChannel::MainFrameWillHappenOnImplForTesting(
122 CompletionEvent* completion,
123 bool* main_frame_will_happen) {
124 ImplThreadTaskRunner()->PostTask(
125 FROM_HERE, base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting,
126 proxy_impl_->GetImplWeakPtr(), completion,
127 main_frame_will_happen));
128 }
129
45 void ThreadedChannel::DidCompleteSwapBuffers() { 130 void ThreadedChannel::DidCompleteSwapBuffers() {
46 MainThreadTaskRunner()->PostTask( 131 MainThreadTaskRunner()->PostTask(
47 FROM_HERE, base::Bind(&ProxyMain::DidCompleteSwapBuffers, 132 FROM_HERE, base::Bind(&ProxyMain::DidCompleteSwapBuffers,
48 proxy_main_->GetMainWeakPtr())); 133 proxy_main_->GetMainWeakPtr()));
49 } 134 }
50 135
136 void ThreadedChannel::SetRendererCapabilitiesMainCopy(
137 const RendererCapabilities& capabilities) {
138 MainThreadTaskRunner()->PostTask(
139 FROM_HERE, base::Bind(&ProxyMain::SetRendererCapabilitiesMainCopy,
140 proxy_main_->GetMainWeakPtr(), capabilities));
141 }
142
143 void ThreadedChannel::BeginMainFrameNotExpectedSoon() {
144 MainThreadTaskRunner()->PostTask(
145 FROM_HERE, base::Bind(&ProxyMain::BeginMainFrameNotExpectedSoon,
146 proxy_main_->GetMainWeakPtr()));
147 }
148
149 void ThreadedChannel::DidCommitAndDrawFrame() {
150 MainThreadTaskRunner()->PostTask(FROM_HERE,
151 base::Bind(&ProxyMain::DidCommitAndDrawFrame,
152 proxy_main_->GetMainWeakPtr()));
153 }
154
155 void ThreadedChannel::SetAnimationEvents(
156 scoped_ptr<AnimationEventsVector> queue) {
157 MainThreadTaskRunner()->PostTask(
158 FROM_HERE,
159 base::Bind(&ProxyMain::SetAnimationEvents, proxy_main_->GetMainWeakPtr(),
160 base::Passed(&queue)));
161 }
162
163 void ThreadedChannel::DidLoseOutputSurface() {
164 MainThreadTaskRunner()->PostTask(FROM_HERE,
165 base::Bind(&ProxyMain::DidLoseOutputSurface,
166 proxy_main_->GetMainWeakPtr()));
167 }
168
169 void ThreadedChannel::RequestNewOutputSurface() {
170 MainThreadTaskRunner()->PostTask(
171 FROM_HERE, base::Bind(&ProxyMain::RequestNewOutputSurface,
172 proxy_main_->GetMainWeakPtr()));
173 }
174
175 void ThreadedChannel::DidInitializeOutputSurface(
176 bool success,
177 const RendererCapabilities& capabilities) {
178 MainThreadTaskRunner()->PostTask(
179 FROM_HERE,
180 base::Bind(&ProxyMain::DidInitializeOutputSurface,
181 proxy_main_->GetMainWeakPtr(), success, capabilities));
182 }
183
184 void ThreadedChannel::DidCompletePageScaleAnimation() {
185 MainThreadTaskRunner()->PostTask(
186 FROM_HERE, base::Bind(&ProxyMain::DidCompletePageScaleAnimation,
187 proxy_main_->GetMainWeakPtr()));
188 }
189
190 void ThreadedChannel::PostFrameTimingEventsOnMain(
191 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
192 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
193 MainThreadTaskRunner()->PostTask(
194 FROM_HERE, base::Bind(&ProxyMain::PostFrameTimingEventsOnMain,
195 proxy_main_->GetMainWeakPtr(),
196 base::Passed(composite_events.Pass()),
197 base::Passed(main_frame_events.Pass())));
198 }
199
200 void ThreadedChannel::BeginMainFrame(
201 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) {
202 MainThreadTaskRunner()->PostTask(
203 FROM_HERE,
204 base::Bind(&ProxyMain::BeginMainFrame, proxy_main_->GetMainWeakPtr(),
205 base::Passed(&begin_main_frame_state)));
206 }
207
51 ThreadedChannel::~ThreadedChannel() { 208 ThreadedChannel::~ThreadedChannel() {
52 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel"); 209 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel");
53 } 210 }
54 211
55 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const { 212 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const {
56 return main_task_runner_.get(); 213 return main_task_runner_.get();
57 } 214 }
58 215
59 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const { 216 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const {
60 return impl_task_runner_.get(); 217 return impl_task_runner_.get();
61 } 218 }
62 219
63 } // namespace cc 220 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/threaded_channel.h ('k') | cc/trees/threaded_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698