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 14 matching lines...) Expand all Loading... |
25 LayerTreeHostSingleThreadClient* client, | 25 LayerTreeHostSingleThreadClient* client, |
26 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { | 26 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { |
27 return make_scoped_ptr( | 27 return make_scoped_ptr( |
28 new SingleThreadProxy(layer_tree_host, client, main_task_runner)); | 28 new SingleThreadProxy(layer_tree_host, client, main_task_runner)); |
29 } | 29 } |
30 | 30 |
31 SingleThreadProxy::SingleThreadProxy( | 31 SingleThreadProxy::SingleThreadProxy( |
32 LayerTreeHost* layer_tree_host, | 32 LayerTreeHost* layer_tree_host, |
33 LayerTreeHostSingleThreadClient* client, | 33 LayerTreeHostSingleThreadClient* client, |
34 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) | 34 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) |
35 : Proxy(main_task_runner, NULL), | 35 : Proxy(main_task_runner, nullptr), |
36 layer_tree_host_(layer_tree_host), | 36 layer_tree_host_(layer_tree_host), |
37 client_(client), | 37 client_(client), |
38 timing_history_(layer_tree_host->rendering_stats_instrumentation()), | 38 timing_history_(layer_tree_host->rendering_stats_instrumentation()), |
39 next_frame_is_newly_committed_frame_(false), | 39 next_frame_is_newly_committed_frame_(false), |
40 inside_draw_(false), | 40 inside_draw_(false), |
41 defer_commits_(false), | 41 defer_commits_(false), |
42 commit_was_deferred_(false), | 42 commit_was_deferred_(false), |
43 commit_requested_(false), | 43 commit_requested_(false), |
44 weak_factory_(this) { | 44 weak_factory_(this) { |
45 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); | 45 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 layer_tree_host_impl_->BeginCommit(); | 175 layer_tree_host_impl_->BeginCommit(); |
176 | 176 |
177 if (PrioritizedResourceManager* contents_texture_manager = | 177 if (PrioritizedResourceManager* contents_texture_manager = |
178 layer_tree_host_->contents_texture_manager()) { | 178 layer_tree_host_->contents_texture_manager()) { |
179 contents_texture_manager->PushTexturePrioritiesToBackings(); | 179 contents_texture_manager->PushTexturePrioritiesToBackings(); |
180 } | 180 } |
181 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); | 181 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); |
182 | 182 |
183 scoped_ptr<ResourceUpdateController> update_controller = | 183 scoped_ptr<ResourceUpdateController> update_controller = |
184 ResourceUpdateController::Create( | 184 ResourceUpdateController::Create( |
185 NULL, | 185 nullptr, |
186 MainThreadTaskRunner(), | 186 MainThreadTaskRunner(), |
187 queue_for_commit_.Pass(), | 187 queue_for_commit_.Pass(), |
188 layer_tree_host_impl_->resource_provider()); | 188 layer_tree_host_impl_->resource_provider()); |
189 update_controller->Finalize(); | 189 update_controller->Finalize(); |
190 | 190 |
191 if (layer_tree_host_impl_->EvictedUIResourcesExist()) | 191 if (layer_tree_host_impl_->EvictedUIResourcesExist()) |
192 layer_tree_host_->RecreateUIResources(); | 192 layer_tree_host_->RecreateUIResources(); |
193 | 193 |
194 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); | 194 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); |
195 | 195 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 307 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
308 DebugScopedSetImplThread impl(this); | 308 DebugScopedSetImplThread impl(this); |
309 | 309 |
310 BlockingTaskRunner::CapturePostTasks blocked( | 310 BlockingTaskRunner::CapturePostTasks blocked( |
311 blocking_main_thread_task_runner()); | 311 blocking_main_thread_task_runner()); |
312 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 312 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
313 layer_tree_host_impl_->resource_provider()); | 313 layer_tree_host_impl_->resource_provider()); |
314 scheduler_on_impl_thread_ = nullptr; | 314 scheduler_on_impl_thread_ = nullptr; |
315 layer_tree_host_impl_ = nullptr; | 315 layer_tree_host_impl_ = nullptr; |
316 } | 316 } |
317 layer_tree_host_ = NULL; | 317 layer_tree_host_ = nullptr; |
318 } | 318 } |
319 | 319 |
320 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 320 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
321 TRACE_EVENT1( | 321 TRACE_EVENT1( |
322 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 322 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
323 DCHECK(Proxy::IsImplThread()); | 323 DCHECK(Proxy::IsImplThread()); |
324 UpdateBackgroundAnimateTicking(); | 324 UpdateBackgroundAnimateTicking(); |
325 if (scheduler_on_impl_thread_) | 325 if (scheduler_on_impl_thread_) |
326 scheduler_on_impl_thread_->SetCanDraw(can_draw); | 326 scheduler_on_impl_thread_->SetCanDraw(can_draw); |
327 } | 327 } |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 | 762 |
763 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 763 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
764 return timing_history_.CommitToActivateDurationEstimate(); | 764 return timing_history_.CommitToActivateDurationEstimate(); |
765 } | 765 } |
766 | 766 |
767 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 767 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
768 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 768 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
769 } | 769 } |
770 | 770 |
771 } // namespace cc | 771 } // namespace cc |
OLD | NEW |