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 <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void ProxyImpl::UpdateBrowserControlsStateOnImpl( | 119 void ProxyImpl::UpdateBrowserControlsStateOnImpl( |
120 BrowserControlsState constraints, | 120 BrowserControlsState constraints, |
121 BrowserControlsState current, | 121 BrowserControlsState current, |
122 bool animate) { | 122 bool animate) { |
123 DCHECK(IsImplThread()); | 123 DCHECK(IsImplThread()); |
124 layer_tree_host_impl_->browser_controls_manager()->UpdateBrowserControlsState( | 124 layer_tree_host_impl_->browser_controls_manager()->UpdateBrowserControlsState( |
125 constraints, current, animate); | 125 constraints, current, animate); |
126 } | 126 } |
127 | 127 |
128 void ProxyImpl::InitializeCompositorFrameSinkOnImpl( | 128 void ProxyImpl::InitializeCompositorFrameSinkOnImpl( |
129 CompositorFrameSink* compositor_frame_sink) { | 129 CompositorFrameSink* compositor_frame_sink, |
| 130 base::WeakPtr<ProxyMain> proxy_main_frame_sink_bound_weak_ptr) { |
130 TRACE_EVENT0("cc", "ProxyImpl::InitializeCompositorFrameSinkOnImplThread"); | 131 TRACE_EVENT0("cc", "ProxyImpl::InitializeCompositorFrameSinkOnImplThread"); |
131 DCHECK(IsImplThread()); | 132 DCHECK(IsImplThread()); |
132 | 133 |
| 134 proxy_main_frame_sink_bound_weak_ptr_ = proxy_main_frame_sink_bound_weak_ptr; |
| 135 |
133 LayerTreeHostImpl* host_impl = layer_tree_host_impl_.get(); | 136 LayerTreeHostImpl* host_impl = layer_tree_host_impl_.get(); |
134 bool success = host_impl->InitializeRenderer(compositor_frame_sink); | 137 bool success = host_impl->InitializeRenderer(compositor_frame_sink); |
135 MainThreadTaskRunner()->PostTask( | 138 MainThreadTaskRunner()->PostTask( |
136 FROM_HERE, base::BindOnce(&ProxyMain::DidInitializeCompositorFrameSink, | 139 FROM_HERE, base::BindOnce(&ProxyMain::DidInitializeCompositorFrameSink, |
137 proxy_main_weak_ptr_, success)); | 140 proxy_main_weak_ptr_, success)); |
138 if (success) | 141 if (success) |
139 scheduler_->DidCreateAndInitializeCompositorFrameSink(); | 142 scheduler_->DidCreateAndInitializeCompositorFrameSink(); |
140 } | 143 } |
141 | 144 |
142 void ProxyImpl::MainThreadHasStoppedFlingingOnImpl() { | 145 void ProxyImpl::MainThreadHasStoppedFlingingOnImpl() { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } | 310 } |
308 } | 311 } |
309 | 312 |
310 void ProxyImpl::DidReceiveCompositorFrameAckOnImplThread() { | 313 void ProxyImpl::DidReceiveCompositorFrameAckOnImplThread() { |
311 TRACE_EVENT0("cc,benchmark", | 314 TRACE_EVENT0("cc,benchmark", |
312 "ProxyImpl::DidReceiveCompositorFrameAckOnImplThread"); | 315 "ProxyImpl::DidReceiveCompositorFrameAckOnImplThread"); |
313 DCHECK(IsImplThread()); | 316 DCHECK(IsImplThread()); |
314 scheduler_->DidReceiveCompositorFrameAck(); | 317 scheduler_->DidReceiveCompositorFrameAck(); |
315 MainThreadTaskRunner()->PostTask( | 318 MainThreadTaskRunner()->PostTask( |
316 FROM_HERE, base::BindOnce(&ProxyMain::DidReceiveCompositorFrameAck, | 319 FROM_HERE, base::BindOnce(&ProxyMain::DidReceiveCompositorFrameAck, |
317 proxy_main_weak_ptr_)); | 320 proxy_main_frame_sink_bound_weak_ptr_)); |
318 } | 321 } |
319 | 322 |
320 void ProxyImpl::OnCanDrawStateChanged(bool can_draw) { | 323 void ProxyImpl::OnCanDrawStateChanged(bool can_draw) { |
321 TRACE_EVENT1("cc", "ProxyImpl::OnCanDrawStateChanged", "can_draw", can_draw); | 324 TRACE_EVENT1("cc", "ProxyImpl::OnCanDrawStateChanged", "can_draw", can_draw); |
322 DCHECK(IsImplThread()); | 325 DCHECK(IsImplThread()); |
323 scheduler_->SetCanDraw(can_draw); | 326 scheduler_->SetCanDraw(can_draw); |
324 } | 327 } |
325 | 328 |
326 void ProxyImpl::NotifyReadyToActivate() { | 329 void ProxyImpl::NotifyReadyToActivate() { |
327 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToActivate"); | 330 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToActivate"); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 686 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
684 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 687 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
685 return main_thread_blocked_commit_vars_unsafe_; | 688 return main_thread_blocked_commit_vars_unsafe_; |
686 } | 689 } |
687 | 690 |
688 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { | 691 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { |
689 return task_runner_provider_->MainThreadTaskRunner(); | 692 return task_runner_provider_->MainThreadTaskRunner(); |
690 } | 693 } |
691 | 694 |
692 } // namespace cc | 695 } // namespace cc |
OLD | NEW |