OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/single_thread_proxy.h" | 5 #include "cc/trees/single_thread_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 LayerTreeHostSingleThreadClient* client, | 26 LayerTreeHostSingleThreadClient* client, |
27 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { | 27 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { |
28 return make_scoped_ptr( | 28 return make_scoped_ptr( |
29 new SingleThreadProxy(layer_tree_host, client, main_task_runner)); | 29 new SingleThreadProxy(layer_tree_host, client, main_task_runner)); |
30 } | 30 } |
31 | 31 |
32 SingleThreadProxy::SingleThreadProxy( | 32 SingleThreadProxy::SingleThreadProxy( |
33 LayerTreeHost* layer_tree_host, | 33 LayerTreeHost* layer_tree_host, |
34 LayerTreeHostSingleThreadClient* client, | 34 LayerTreeHostSingleThreadClient* client, |
35 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) | 35 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) |
36 : Proxy(main_task_runner, NULL), | 36 : Proxy(main_task_runner, nullptr), |
37 layer_tree_host_(layer_tree_host), | 37 layer_tree_host_(layer_tree_host), |
38 client_(client), | 38 client_(client), |
39 timing_history_(layer_tree_host->rendering_stats_instrumentation()), | 39 timing_history_(layer_tree_host->rendering_stats_instrumentation()), |
40 next_frame_is_newly_committed_frame_(false), | 40 next_frame_is_newly_committed_frame_(false), |
41 inside_draw_(false), | 41 inside_draw_(false), |
42 defer_commits_(false), | 42 defer_commits_(false), |
43 commit_was_deferred_(false), | 43 commit_was_deferred_(false), |
44 commit_requested_(false), | 44 commit_requested_(false), |
45 weak_factory_(this) { | 45 weak_factory_(this) { |
46 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); | 46 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 layer_tree_host_impl_->BeginCommit(); | 198 layer_tree_host_impl_->BeginCommit(); |
199 | 199 |
200 if (PrioritizedResourceManager* contents_texture_manager = | 200 if (PrioritizedResourceManager* contents_texture_manager = |
201 layer_tree_host_->contents_texture_manager()) { | 201 layer_tree_host_->contents_texture_manager()) { |
202 contents_texture_manager->PushTexturePrioritiesToBackings(); | 202 contents_texture_manager->PushTexturePrioritiesToBackings(); |
203 } | 203 } |
204 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); | 204 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); |
205 | 205 |
206 scoped_ptr<ResourceUpdateController> update_controller = | 206 scoped_ptr<ResourceUpdateController> update_controller = |
207 ResourceUpdateController::Create( | 207 ResourceUpdateController::Create( |
208 NULL, | 208 nullptr, |
209 MainThreadTaskRunner(), | 209 MainThreadTaskRunner(), |
210 queue.Pass(), | 210 queue.Pass(), |
211 layer_tree_host_impl_->resource_provider()); | 211 layer_tree_host_impl_->resource_provider()); |
212 update_controller->Finalize(); | 212 update_controller->Finalize(); |
213 | 213 |
214 if (layer_tree_host_impl_->EvictedUIResourcesExist()) | 214 if (layer_tree_host_impl_->EvictedUIResourcesExist()) |
215 layer_tree_host_->RecreateUIResources(); | 215 layer_tree_host_->RecreateUIResources(); |
216 | 216 |
217 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); | 217 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); |
218 | 218 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 309 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
310 DebugScopedSetImplThread impl(this); | 310 DebugScopedSetImplThread impl(this); |
311 | 311 |
312 BlockingTaskRunner::CapturePostTasks blocked( | 312 BlockingTaskRunner::CapturePostTasks blocked( |
313 blocking_main_thread_task_runner()); | 313 blocking_main_thread_task_runner()); |
314 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 314 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
315 layer_tree_host_impl_->resource_provider()); | 315 layer_tree_host_impl_->resource_provider()); |
316 scheduler_on_impl_thread_ = nullptr; | 316 scheduler_on_impl_thread_ = nullptr; |
317 layer_tree_host_impl_ = nullptr; | 317 layer_tree_host_impl_ = nullptr; |
318 } | 318 } |
319 layer_tree_host_ = NULL; | 319 layer_tree_host_ = nullptr; |
320 } | 320 } |
321 | 321 |
322 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 322 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
323 TRACE_EVENT1( | 323 TRACE_EVENT1( |
324 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 324 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
325 DCHECK(Proxy::IsImplThread()); | 325 DCHECK(Proxy::IsImplThread()); |
326 UpdateBackgroundAnimateTicking(); | 326 UpdateBackgroundAnimateTicking(); |
327 if (scheduler_on_impl_thread_) | 327 if (scheduler_on_impl_thread_) |
328 scheduler_on_impl_thread_->SetCanDraw(can_draw); | 328 scheduler_on_impl_thread_->SetCanDraw(can_draw); |
329 } | 329 } |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 | 683 |
684 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 684 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
685 return timing_history_.CommitToActivateDurationEstimate(); | 685 return timing_history_.CommitToActivateDurationEstimate(); |
686 } | 686 } |
687 | 687 |
688 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 688 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
689 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 689 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
690 } | 690 } |
691 | 691 |
692 } // namespace cc | 692 } // namespace cc |
OLD | NEW |