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

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: Add remaining post task methods. Created 5 years, 2 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
« cc/trees/thread_proxy.cc ('K') | « cc/trees/threaded_channel.h ('k') | no next file » | 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(
96 CompletionEvent* completion,
97 BlockedMainCommitState* blocked_main_commit_state) {
98 ImplThreadTaskRunner()->PostTask(
99 FROM_HERE,
100 base::Bind(&ProxyImpl::StartCommitOnImpl, proxy_impl_->GetImplWeakPtr(),
101 completion, blocked_main_commit_state));
102 }
103
104 void ThreadedChannel::SetVisibleOnImpl(CompletionEvent* completion,
105 bool visible) {
106 ImplThreadTaskRunner()->PostTask(
107 FROM_HERE,
108 base::Bind(&ProxyImpl::SetVisibleOnImpl, proxy_impl_->GetImplWeakPtr(),
109 completion, visible));
110 }
111
112 void ThreadedChannel::ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) {
113 ImplThreadTaskRunner()->PostTask(
114 FROM_HERE, base::Bind(&ProxyImpl::ReleaseOutputSurfaceOnImpl,
115 proxy_impl_->GetImplWeakPtr(), completion));
116 }
117
118 void ThreadedChannel::FinishGLOnImpl(CompletionEvent* completion) {
119 ImplThreadTaskRunner()->PostTask(
120 FROM_HERE, base::Bind(&ProxyImpl::FinishGLOnImpl,
121 proxy_impl_->GetImplWeakPtr(), completion));
122 }
123
124 void ThreadedChannel::MainFrameWillHappenOnImplForTesting(
125 CompletionEvent* completion,
126 bool* main_frame_will_happen) {
127 ImplThreadTaskRunner()->PostTask(
128 FROM_HERE, base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting,
129 proxy_impl_->GetImplWeakPtr(), completion,
130 main_frame_will_happen));
131 }
132
45 void ThreadedChannel::DidCompleteSwapBuffers() { 133 void ThreadedChannel::DidCompleteSwapBuffers() {
46 MainThreadTaskRunner()->PostTask( 134 MainThreadTaskRunner()->PostTask(
47 FROM_HERE, base::Bind(&ProxyMain::DidCompleteSwapBuffers, 135 FROM_HERE, base::Bind(&ProxyMain::DidCompleteSwapBuffers,
48 proxy_main_->GetMainWeakPtr())); 136 proxy_main_->GetMainWeakPtr()));
49 } 137 }
50 138
139 void ThreadedChannel::SetRendererCapabilitiesMainCopy(
140 const RendererCapabilities& capabilities) {
141 MainThreadTaskRunner()->PostTask(
142 FROM_HERE, base::Bind(&ProxyMain::SetRendererCapabilitiesMainCopy,
143 proxy_main_->GetMainWeakPtr(), capabilities));
144 }
145
146 void ThreadedChannel::BeginMainFrameNotExpectedSoon() {
147 MainThreadTaskRunner()->PostTask(
148 FROM_HERE, base::Bind(&ProxyMain::BeginMainFrameNotExpectedSoon,
149 proxy_main_->GetMainWeakPtr()));
150 }
151
152 void ThreadedChannel::DidCommitAndDrawFrame() {
153 MainThreadTaskRunner()->PostTask(FROM_HERE,
154 base::Bind(&ProxyMain::DidCommitAndDrawFrame,
155 proxy_main_->GetMainWeakPtr()));
156 }
157
158 void ThreadedChannel::SetAnimationEvents(
159 scoped_ptr<AnimationEventsVector> queue) {
160 MainThreadTaskRunner()->PostTask(
161 FROM_HERE,
162 base::Bind(&ProxyMain::SetAnimationEvents, proxy_main_->GetMainWeakPtr(),
163 base::Passed(&queue)));
164 }
165
166 void ThreadedChannel::DidLoseOutputSurface() {
167 MainThreadTaskRunner()->PostTask(FROM_HERE,
168 base::Bind(&ProxyMain::DidLoseOutputSurface,
169 proxy_main_->GetMainWeakPtr()));
170 }
171
172 void ThreadedChannel::RequestNewOutputSurface() {
173 MainThreadTaskRunner()->PostTask(
174 FROM_HERE, base::Bind(&ProxyMain::RequestNewOutputSurface,
175 proxy_main_->GetMainWeakPtr()));
176 }
177
178 void ThreadedChannel::DidInitializeOutputSurface(
179 bool success,
180 const RendererCapabilities& capabilities) {
181 MainThreadTaskRunner()->PostTask(
182 FROM_HERE,
183 base::Bind(&ProxyMain::DidInitializeOutputSurface,
184 proxy_main_->GetMainWeakPtr(), success, capabilities));
185 }
186
187 void ThreadedChannel::DidCompletePageScaleAnimation() {
188 MainThreadTaskRunner()->PostTask(
189 FROM_HERE, base::Bind(&ProxyMain::DidCompletePageScaleAnimation,
190 proxy_main_->GetMainWeakPtr()));
191 }
192
193 void ThreadedChannel::PostFrameTimingEventsOnMain(
194 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
195 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
196 MainThreadTaskRunner()->PostTask(
197 FROM_HERE, base::Bind(&ProxyMain::PostFrameTimingEventsOnMain,
198 proxy_main_->GetMainWeakPtr(),
199 base::Passed(composite_events.Pass()),
200 base::Passed(main_frame_events.Pass())));
201 }
202
203 void ThreadedChannel::BeginMainFrame(
204 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) {
205 MainThreadTaskRunner()->PostTask(
206 FROM_HERE,
207 base::Bind(&ProxyMain::BeginMainFrame, proxy_main_->GetMainWeakPtr(),
208 base::Passed(&begin_main_frame_state)));
209 }
210
51 ThreadedChannel::~ThreadedChannel() { 211 ThreadedChannel::~ThreadedChannel() {
52 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel"); 212 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel");
53 } 213 }
54 214
55 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const { 215 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const {
56 return main_task_runner_.get(); 216 return main_task_runner_.get();
57 } 217 }
58 218
59 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const { 219 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const {
60 return impl_task_runner_.get(); 220 return impl_task_runner_.get();
61 } 221 }
62 222
63 } // namespace cc 223 } // namespace cc
OLDNEW
« cc/trees/thread_proxy.cc ('K') | « cc/trees/threaded_channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698