Chromium Code Reviews| 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/proxy_impl.h" | 5 #include "cc/trees/proxy_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 void ProxyImpl::UpdateBrowserControlsStateOnImpl( | 115 void ProxyImpl::UpdateBrowserControlsStateOnImpl( |
| 116 BrowserControlsState constraints, | 116 BrowserControlsState constraints, |
| 117 BrowserControlsState current, | 117 BrowserControlsState current, |
| 118 bool animate) { | 118 bool animate) { |
| 119 DCHECK(IsImplThread()); | 119 DCHECK(IsImplThread()); |
| 120 layer_tree_host_impl_->browser_controls_manager()->UpdateBrowserControlsState( | 120 layer_tree_host_impl_->browser_controls_manager()->UpdateBrowserControlsState( |
| 121 constraints, current, animate); | 121 constraints, current, animate); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void ProxyImpl::InitializeCompositorFrameSinkOnImpl( | 124 void ProxyImpl::InitializeCompositorFrameSinkOnImpl( |
| 125 CompositorFrameSink* compositor_frame_sink) { | 125 CompositorFrameSink* compositor_frame_sink, |
| 126 base::WeakPtr<ProxyMain> compositor_frame_sink_weak_ptr) { | |
|
danakj
2017/04/05 16:08:49
If you want, and I think it'd be slightly simpler,
| |
| 126 TRACE_EVENT0("cc", "ProxyImpl::InitializeCompositorFrameSinkOnImplThread"); | 127 TRACE_EVENT0("cc", "ProxyImpl::InitializeCompositorFrameSinkOnImplThread"); |
| 127 DCHECK(IsImplThread()); | 128 DCHECK(IsImplThread()); |
| 128 | 129 |
| 130 compositor_frame_sink_weak_ptr_ = compositor_frame_sink_weak_ptr; | |
| 131 | |
| 129 LayerTreeHostImpl* host_impl = layer_tree_host_impl_.get(); | 132 LayerTreeHostImpl* host_impl = layer_tree_host_impl_.get(); |
| 130 bool success = host_impl->InitializeRenderer(compositor_frame_sink); | 133 bool success = host_impl->InitializeRenderer(compositor_frame_sink); |
| 131 MainThreadTaskRunner()->PostTask( | 134 MainThreadTaskRunner()->PostTask( |
| 132 FROM_HERE, base::Bind(&ProxyMain::DidInitializeCompositorFrameSink, | 135 FROM_HERE, base::Bind(&ProxyMain::DidInitializeCompositorFrameSink, |
| 133 proxy_main_weak_ptr_, success)); | 136 proxy_main_weak_ptr_, success)); |
| 134 if (success) | 137 if (success) |
| 135 scheduler_->DidCreateAndInitializeCompositorFrameSink(); | 138 scheduler_->DidCreateAndInitializeCompositorFrameSink(); |
| 136 } | 139 } |
| 137 | 140 |
| 138 void ProxyImpl::MainThreadHasStoppedFlingingOnImpl() { | 141 void ProxyImpl::MainThreadHasStoppedFlingingOnImpl() { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 } | 277 } |
| 275 } | 278 } |
| 276 | 279 |
| 277 void ProxyImpl::DidReceiveCompositorFrameAckOnImplThread() { | 280 void ProxyImpl::DidReceiveCompositorFrameAckOnImplThread() { |
| 278 TRACE_EVENT0("cc,benchmark", | 281 TRACE_EVENT0("cc,benchmark", |
| 279 "ProxyImpl::DidReceiveCompositorFrameAckOnImplThread"); | 282 "ProxyImpl::DidReceiveCompositorFrameAckOnImplThread"); |
| 280 DCHECK(IsImplThread()); | 283 DCHECK(IsImplThread()); |
| 281 scheduler_->DidReceiveCompositorFrameAck(); | 284 scheduler_->DidReceiveCompositorFrameAck(); |
| 282 MainThreadTaskRunner()->PostTask( | 285 MainThreadTaskRunner()->PostTask( |
| 283 FROM_HERE, base::Bind(&ProxyMain::DidReceiveCompositorFrameAck, | 286 FROM_HERE, base::Bind(&ProxyMain::DidReceiveCompositorFrameAck, |
| 284 proxy_main_weak_ptr_)); | 287 compositor_frame_sink_weak_ptr_)); |
| 285 } | 288 } |
| 286 | 289 |
| 287 void ProxyImpl::OnCanDrawStateChanged(bool can_draw) { | 290 void ProxyImpl::OnCanDrawStateChanged(bool can_draw) { |
| 288 TRACE_EVENT1("cc", "ProxyImpl::OnCanDrawStateChanged", "can_draw", can_draw); | 291 TRACE_EVENT1("cc", "ProxyImpl::OnCanDrawStateChanged", "can_draw", can_draw); |
| 289 DCHECK(IsImplThread()); | 292 DCHECK(IsImplThread()); |
| 290 scheduler_->SetCanDraw(can_draw); | 293 scheduler_->SetCanDraw(can_draw); |
| 291 } | 294 } |
| 292 | 295 |
| 293 void ProxyImpl::NotifyReadyToActivate() { | 296 void ProxyImpl::NotifyReadyToActivate() { |
| 294 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToActivate"); | 297 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToActivate"); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 649 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 652 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
| 650 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 653 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
| 651 return main_thread_blocked_commit_vars_unsafe_; | 654 return main_thread_blocked_commit_vars_unsafe_; |
| 652 } | 655 } |
| 653 | 656 |
| 654 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { | 657 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { |
| 655 return task_runner_provider_->MainThreadTaskRunner(); | 658 return task_runner_provider_->MainThreadTaskRunner(); |
| 656 } | 659 } |
| 657 | 660 |
| 658 } // namespace cc | 661 } // namespace cc |
| OLD | NEW |