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

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: Use completion events for blocking calls from ProxyMain. 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
(...skipping 15 matching lines...) Expand all
26 proxy_impl_(thread_proxy), 26 proxy_impl_(thread_proxy),
27 main_task_runner_(main_task_runner), 27 main_task_runner_(main_task_runner),
28 impl_task_runner_(impl_task_runner) {} 28 impl_task_runner_(impl_task_runner) {}
29 29
30 void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) { 30 void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) {
31 ImplThreadTaskRunner()->PostTask( 31 ImplThreadTaskRunner()->PostTask(
32 FROM_HERE, base::Bind(&ProxyImpl::SetThrottleFrameProductionOnImpl, 32 FROM_HERE, base::Bind(&ProxyImpl::SetThrottleFrameProductionOnImpl,
33 proxy_impl_->GetImplWeakPtr(), throttle)); 33 proxy_impl_->GetImplWeakPtr(), throttle));
34 } 34 }
35 35
36 void ThreadedChannel::InitializeOutputSurfaceOnImpl(
37 OutputSurface* output_surface) {
38 ImplThreadTaskRunner()->PostTask(
39 FROM_HERE, base::Bind(&ProxyImpl::InitializeOutputSurfaceOnImpl,
40 proxy_impl_->GetImplWeakPtr(), output_surface));
41 }
42
43 void ThreadedChannel::MainThreadHasStoppedFlingingOnImpl() {
44 ImplThreadTaskRunner()->PostTask(
45 FROM_HERE, base::Bind(&ProxyImpl::MainThreadHasStoppedFlingingOnImpl,
46 proxy_impl_->GetImplWeakPtr()));
47 }
48
49 void ThreadedChannel::SetInputThrottledUntilCommitOnImpl(bool is_throttled) {
50 ImplThreadTaskRunner()->PostTask(
51 FROM_HERE, base::Bind(&ProxyImpl::SetInputThrottledUntilCommitOnImpl,
52 proxy_impl_->GetImplWeakPtr(), is_throttled));
53 }
54
55 void ThreadedChannel::SetDeferCommitsOnImpl(bool defer_commits) {
56 ImplThreadTaskRunner()->PostTask(
57 FROM_HERE, base::Bind(&ProxyImpl::SetDeferCommitsOnImpl,
58 proxy_impl_->GetImplWeakPtr(), defer_commits));
59 }
60
61 void ThreadedChannel::FinishAllRenderingOnImpl(CompletionEvent* completion) {
62 ImplThreadTaskRunner()->PostTask(
63 FROM_HERE, base::Bind(&ProxyImpl::FinishAllRenderingOnImpl,
64 proxy_impl_->GetImplWeakPtr(), completion));
65 }
66
67 void ThreadedChannel::SetVisibleOnImpl(CompletionEvent* completion,
68 bool visible) {
69 ImplThreadTaskRunner()->PostTask(
70 FROM_HERE,
71 base::Bind(&ProxyImpl::SetVisibleOnImpl, proxy_impl_->GetImplWeakPtr(),
72 completion, visible));
73 }
74
75 void ThreadedChannel::ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) {
76 ImplThreadTaskRunner()->PostTask(
77 FROM_HERE, base::Bind(&ProxyImpl::ReleaseOutputSurfaceOnImpl,
78 proxy_impl_->GetImplWeakPtr(), completion));
79 }
80
81 void ThreadedChannel::FinishGLOnImpl(CompletionEvent* completion) {
82 ImplThreadTaskRunner()->PostTask(
83 FROM_HERE, base::Bind(&ProxyImpl::FinishGLOnImpl,
84 proxy_impl_->GetImplWeakPtr(), completion));
85 }
86
87 void ThreadedChannel::MainFrameWillHappenOnImplForTesting(
88 CompletionEvent* completion,
89 bool* main_frame_will_happen) {
90 ImplThreadTaskRunner()->PostTask(
91 FROM_HERE, base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting,
92 proxy_impl_->GetImplWeakPtr(), completion,
93 main_frame_will_happen));
94 }
95
36 void ThreadedChannel::DidCompleteSwapBuffers() { 96 void ThreadedChannel::DidCompleteSwapBuffers() {
37 MainThreadTaskRunner()->PostTask( 97 MainThreadTaskRunner()->PostTask(
38 FROM_HERE, base::Bind(&ProxyMain::DidCompleteSwapBuffers, 98 FROM_HERE, base::Bind(&ProxyMain::DidCompleteSwapBuffers,
39 proxy_main_->GetMainWeakPtr())); 99 proxy_main_->GetMainWeakPtr()));
40 } 100 }
41 101
102 void ThreadedChannel::SetRendererCapabilitiesMainCopy(
103 const RendererCapabilities& capabilities) {
104 MainThreadTaskRunner()->PostTask(
105 FROM_HERE, base::Bind(&ProxyMain::SetRendererCapabilitiesMainCopy,
106 proxy_main_->GetMainWeakPtr(), capabilities));
107 }
108
109 void ThreadedChannel::BeginMainFrameNotExpectedSoon() {
110 MainThreadTaskRunner()->PostTask(
111 FROM_HERE, base::Bind(&ProxyMain::BeginMainFrameNotExpectedSoon,
112 proxy_main_->GetMainWeakPtr()));
113 }
114
115 void ThreadedChannel::DidCommitAndDrawFrame() {
116 MainThreadTaskRunner()->PostTask(FROM_HERE,
117 base::Bind(&ProxyMain::DidCommitAndDrawFrame,
118 proxy_main_->GetMainWeakPtr()));
119 }
120
121 void ThreadedChannel::SetAnimationEvents(
122 scoped_ptr<AnimationEventsVector> queue) {
123 MainThreadTaskRunner()->PostTask(
124 FROM_HERE,
125 base::Bind(&ProxyMain::SetAnimationEvents, proxy_main_->GetMainWeakPtr(),
126 base::Passed(&queue)));
127 }
128
129 void ThreadedChannel::DidLoseOutputSurface() {
130 MainThreadTaskRunner()->PostTask(FROM_HERE,
131 base::Bind(&ProxyMain::DidLoseOutputSurface,
132 proxy_main_->GetMainWeakPtr()));
133 }
134
135 void ThreadedChannel::RequestNewOutputSurface() {
136 MainThreadTaskRunner()->PostTask(
137 FROM_HERE, base::Bind(&ProxyMain::RequestNewOutputSurface,
138 proxy_main_->GetMainWeakPtr()));
139 }
140
141 void ThreadedChannel::DidInitializeOutputSurface(
142 bool success,
143 const RendererCapabilities& capabilities) {
144 MainThreadTaskRunner()->PostTask(
145 FROM_HERE,
146 base::Bind(&ProxyMain::DidInitializeOutputSurface,
147 proxy_main_->GetMainWeakPtr(), success, capabilities));
148 }
149
150 void ThreadedChannel::DidCompletePageScaleAnimation() {
151 MainThreadTaskRunner()->PostTask(
152 FROM_HERE, base::Bind(&ProxyMain::DidCompletePageScaleAnimation,
153 proxy_main_->GetMainWeakPtr()));
154 }
155
156 void ThreadedChannel::PostFrameTimingEventsOnMain(
157 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
158 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
159 MainThreadTaskRunner()->PostTask(
160 FROM_HERE, base::Bind(&ProxyMain::PostFrameTimingEventsOnMain,
161 proxy_main_->GetMainWeakPtr(),
162 base::Passed(composite_events.Pass()),
163 base::Passed(main_frame_events.Pass())));
164 }
165
42 ThreadedChannel::~ThreadedChannel() { 166 ThreadedChannel::~ThreadedChannel() {
43 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel"); 167 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel");
44 } 168 }
45 169
46 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const { 170 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const {
47 return main_task_runner_.get(); 171 return main_task_runner_.get();
48 } 172 }
49 173
50 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const { 174 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const {
51 return impl_task_runner_.get(); 175 return impl_task_runner_.get();
52 } 176 }
53 177
54 } // namespace cc 178 } // 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