| OLD | NEW |
| 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/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 void ThreadedChannel::UpdateTopControlsStateOnImpl(TopControlsState constraints, | 40 void ThreadedChannel::UpdateTopControlsStateOnImpl(TopControlsState constraints, |
| 41 TopControlsState current, | 41 TopControlsState current, |
| 42 bool animate) { | 42 bool animate) { |
| 43 DCHECK(IsMainThread()); | 43 DCHECK(IsMainThread()); |
| 44 ImplThreadTaskRunner()->PostTask( | 44 ImplThreadTaskRunner()->PostTask( |
| 45 FROM_HERE, | 45 FROM_HERE, |
| 46 base::Bind(&ProxyImpl::UpdateTopControlsStateOnImpl, proxy_impl_weak_ptr_, | 46 base::Bind(&ProxyImpl::UpdateTopControlsStateOnImpl, proxy_impl_weak_ptr_, |
| 47 constraints, current, animate)); | 47 constraints, current, animate)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void ThreadedChannel::InitializeOutputSurfaceOnImpl( | 50 void ThreadedChannel::InitializeCompositorFrameSinkOnImpl( |
| 51 OutputSurface* output_surface) { | 51 CompositorFrameSink* output_surface) { |
| 52 DCHECK(IsMainThread()); | 52 DCHECK(IsMainThread()); |
| 53 ImplThreadTaskRunner()->PostTask( | 53 ImplThreadTaskRunner()->PostTask( |
| 54 FROM_HERE, base::Bind(&ProxyImpl::InitializeOutputSurfaceOnImpl, | 54 FROM_HERE, base::Bind(&ProxyImpl::InitializeCompositorFrameSinkOnImpl, |
| 55 proxy_impl_weak_ptr_, output_surface)); | 55 proxy_impl_weak_ptr_, output_surface)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ThreadedChannel::InitializeMutatorOnImpl( | 58 void ThreadedChannel::InitializeMutatorOnImpl( |
| 59 std::unique_ptr<LayerTreeMutator> mutator) { | 59 std::unique_ptr<LayerTreeMutator> mutator) { |
| 60 ImplThreadTaskRunner()->PostTask( | 60 ImplThreadTaskRunner()->PostTask( |
| 61 FROM_HERE, | 61 FROM_HERE, |
| 62 base::Bind(&ProxyImpl::InitializeMutatorOnImpl, proxy_impl_weak_ptr_, | 62 base::Bind(&ProxyImpl::InitializeMutatorOnImpl, proxy_impl_weak_ptr_, |
| 63 base::Passed(std::move(mutator)))); | 63 base::Passed(std::move(mutator)))); |
| 64 } | 64 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 proxy_impl_weak_ptr_, damage_rect)); | 109 proxy_impl_weak_ptr_, damage_rect)); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void ThreadedChannel::SetVisibleOnImpl(bool visible) { | 112 void ThreadedChannel::SetVisibleOnImpl(bool visible) { |
| 113 DCHECK(IsMainThread()); | 113 DCHECK(IsMainThread()); |
| 114 ImplThreadTaskRunner()->PostTask( | 114 ImplThreadTaskRunner()->PostTask( |
| 115 FROM_HERE, | 115 FROM_HERE, |
| 116 base::Bind(&ProxyImpl::SetVisibleOnImpl, proxy_impl_weak_ptr_, visible)); | 116 base::Bind(&ProxyImpl::SetVisibleOnImpl, proxy_impl_weak_ptr_, visible)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void ThreadedChannel::ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) { | 119 void ThreadedChannel::ReleaseCompositorFrameSinkOnImpl( |
| 120 CompletionEvent* completion) { |
| 120 DCHECK(IsMainThread()); | 121 DCHECK(IsMainThread()); |
| 121 ImplThreadTaskRunner()->PostTask( | 122 ImplThreadTaskRunner()->PostTask( |
| 122 FROM_HERE, base::Bind(&ProxyImpl::ReleaseOutputSurfaceOnImpl, | 123 FROM_HERE, base::Bind(&ProxyImpl::ReleaseCompositorFrameSinkOnImpl, |
| 123 proxy_impl_weak_ptr_, completion)); | 124 proxy_impl_weak_ptr_, completion)); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void ThreadedChannel::MainFrameWillHappenOnImplForTesting( | 127 void ThreadedChannel::MainFrameWillHappenOnImplForTesting( |
| 127 CompletionEvent* completion, | 128 CompletionEvent* completion, |
| 128 bool* main_frame_will_happen) { | 129 bool* main_frame_will_happen) { |
| 129 DCHECK(IsMainThread()); | 130 DCHECK(IsMainThread()); |
| 130 ImplThreadTaskRunner()->PostTask( | 131 ImplThreadTaskRunner()->PostTask( |
| 131 FROM_HERE, | 132 FROM_HERE, |
| 132 base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting, | 133 base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 215 } |
| 215 | 216 |
| 216 void ThreadedChannel::SetAnimationEvents( | 217 void ThreadedChannel::SetAnimationEvents( |
| 217 std::unique_ptr<AnimationEvents> events) { | 218 std::unique_ptr<AnimationEvents> events) { |
| 218 DCHECK(IsImplThread()); | 219 DCHECK(IsImplThread()); |
| 219 MainThreadTaskRunner()->PostTask( | 220 MainThreadTaskRunner()->PostTask( |
| 220 FROM_HERE, base::Bind(&ProxyMain::SetAnimationEvents, | 221 FROM_HERE, base::Bind(&ProxyMain::SetAnimationEvents, |
| 221 impl().proxy_main_weak_ptr, base::Passed(&events))); | 222 impl().proxy_main_weak_ptr, base::Passed(&events))); |
| 222 } | 223 } |
| 223 | 224 |
| 224 void ThreadedChannel::DidLoseOutputSurface() { | 225 void ThreadedChannel::DidLoseCompositorFrameSink() { |
| 225 DCHECK(IsImplThread()); | 226 DCHECK(IsImplThread()); |
| 226 MainThreadTaskRunner()->PostTask( | 227 MainThreadTaskRunner()->PostTask( |
| 227 FROM_HERE, | 228 FROM_HERE, base::Bind(&ProxyMain::DidLoseCompositorFrameSink, |
| 228 base::Bind(&ProxyMain::DidLoseOutputSurface, impl().proxy_main_weak_ptr)); | |
| 229 } | |
| 230 | |
| 231 void ThreadedChannel::RequestNewOutputSurface() { | |
| 232 DCHECK(IsImplThread()); | |
| 233 MainThreadTaskRunner()->PostTask( | |
| 234 FROM_HERE, base::Bind(&ProxyMain::RequestNewOutputSurface, | |
| 235 impl().proxy_main_weak_ptr)); | 229 impl().proxy_main_weak_ptr)); |
| 236 } | 230 } |
| 237 | 231 |
| 238 void ThreadedChannel::DidInitializeOutputSurface(bool success) { | 232 void ThreadedChannel::RequestNewCompositorFrameSink() { |
| 239 DCHECK(IsImplThread()); | 233 DCHECK(IsImplThread()); |
| 240 MainThreadTaskRunner()->PostTask( | 234 MainThreadTaskRunner()->PostTask( |
| 241 FROM_HERE, base::Bind(&ProxyMain::DidInitializeOutputSurface, | 235 FROM_HERE, base::Bind(&ProxyMain::RequestNewCompositorFrameSink, |
| 236 impl().proxy_main_weak_ptr)); |
| 237 } |
| 238 |
| 239 void ThreadedChannel::DidInitializeCompositorFrameSink(bool success) { |
| 240 DCHECK(IsImplThread()); |
| 241 MainThreadTaskRunner()->PostTask( |
| 242 FROM_HERE, base::Bind(&ProxyMain::DidInitializeCompositorFrameSink, |
| 242 impl().proxy_main_weak_ptr, success)); | 243 impl().proxy_main_weak_ptr, success)); |
| 243 } | 244 } |
| 244 | 245 |
| 245 void ThreadedChannel::DidCompletePageScaleAnimation() { | 246 void ThreadedChannel::DidCompletePageScaleAnimation() { |
| 246 DCHECK(IsImplThread()); | 247 DCHECK(IsImplThread()); |
| 247 MainThreadTaskRunner()->PostTask( | 248 MainThreadTaskRunner()->PostTask( |
| 248 FROM_HERE, base::Bind(&ProxyMain::DidCompletePageScaleAnimation, | 249 FROM_HERE, base::Bind(&ProxyMain::DidCompletePageScaleAnimation, |
| 249 impl().proxy_main_weak_ptr)); | 250 impl().proxy_main_weak_ptr)); |
| 250 } | 251 } |
| 251 | 252 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 341 |
| 341 ThreadedChannel::MainThreadOnly::~MainThreadOnly() {} | 342 ThreadedChannel::MainThreadOnly::~MainThreadOnly() {} |
| 342 | 343 |
| 343 ThreadedChannel::CompositorThreadOnly::CompositorThreadOnly( | 344 ThreadedChannel::CompositorThreadOnly::CompositorThreadOnly( |
| 344 base::WeakPtr<ProxyMain> proxy_main_weak_ptr) | 345 base::WeakPtr<ProxyMain> proxy_main_weak_ptr) |
| 345 : proxy_main_weak_ptr(proxy_main_weak_ptr) {} | 346 : proxy_main_weak_ptr(proxy_main_weak_ptr) {} |
| 346 | 347 |
| 347 ThreadedChannel::CompositorThreadOnly::~CompositorThreadOnly() {} | 348 ThreadedChannel::CompositorThreadOnly::~CompositorThreadOnly() {} |
| 348 | 349 |
| 349 } // namespace cc | 350 } // namespace cc |
| OLD | NEW |