| 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" |
| 11 #include "cc/output/output_surface.h" | 11 #include "cc/output/output_surface.h" |
| 12 #include "cc/quads/draw_quad.h" | 12 #include "cc/quads/draw_quad.h" |
| 13 #include "cc/resources/prioritized_resource_manager.h" | 13 #include "cc/resources/prioritized_resource_manager.h" |
| 14 #include "cc/resources/resource_update_controller.h" | 14 #include "cc/resources/resource_update_controller.h" |
| 15 #include "cc/trees/blocking_task_runner.h" | 15 #include "cc/trees/blocking_task_runner.h" |
| 16 #include "cc/trees/layer_tree_host.h" | 16 #include "cc/trees/layer_tree_host.h" |
| 17 #include "cc/trees/layer_tree_host_single_thread_client.h" | 17 #include "cc/trees/layer_tree_host_single_thread_client.h" |
| 18 #include "cc/trees/layer_tree_impl.h" | 18 #include "cc/trees/layer_tree_impl.h" |
| 19 #include "cc/trees/scoped_abort_remaining_swap_promises.h" | 19 #include "cc/trees/scoped_abort_remaining_swap_promises.h" |
| 20 #include "ui/gfx/frame_time.h" | 20 #include "ui/gfx/frame_time.h" |
| 21 | 21 |
| 22 namespace cc { | 22 namespace cc { |
| 23 | 23 |
| 24 scoped_ptr<Proxy> SingleThreadProxy::Create( | 24 scoped_ptr<Proxy> SingleThreadProxy::Create( |
| 25 LayerTreeHost* layer_tree_host, | 25 LayerTreeHost* layer_tree_host, |
| 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 .PassAs<Proxy>(); | |
| 31 } | 30 } |
| 32 | 31 |
| 33 SingleThreadProxy::SingleThreadProxy( | 32 SingleThreadProxy::SingleThreadProxy( |
| 34 LayerTreeHost* layer_tree_host, | 33 LayerTreeHost* layer_tree_host, |
| 35 LayerTreeHostSingleThreadClient* client, | 34 LayerTreeHostSingleThreadClient* client, |
| 36 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) | 35 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) |
| 37 : Proxy(main_task_runner, NULL), | 36 : Proxy(main_task_runner, NULL), |
| 38 layer_tree_host_(layer_tree_host), | 37 layer_tree_host_(layer_tree_host), |
| 39 client_(client), | 38 client_(client), |
| 40 timing_history_(layer_tree_host->rendering_stats_instrumentation()), | 39 timing_history_(layer_tree_host->rendering_stats_instrumentation()), |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); | 306 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); |
| 308 DCHECK(Proxy::IsMainThread()); | 307 DCHECK(Proxy::IsMainThread()); |
| 309 { | 308 { |
| 310 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 309 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
| 311 DebugScopedSetImplThread impl(this); | 310 DebugScopedSetImplThread impl(this); |
| 312 | 311 |
| 313 BlockingTaskRunner::CapturePostTasks blocked( | 312 BlockingTaskRunner::CapturePostTasks blocked( |
| 314 blocking_main_thread_task_runner()); | 313 blocking_main_thread_task_runner()); |
| 315 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 314 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
| 316 layer_tree_host_impl_->resource_provider()); | 315 layer_tree_host_impl_->resource_provider()); |
| 317 scheduler_on_impl_thread_.reset(); | 316 scheduler_on_impl_thread_ = nullptr; |
| 318 layer_tree_host_impl_.reset(); | 317 layer_tree_host_impl_ = nullptr; |
| 319 } | 318 } |
| 320 layer_tree_host_ = NULL; | 319 layer_tree_host_ = NULL; |
| 321 } | 320 } |
| 322 | 321 |
| 323 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 322 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
| 324 TRACE_EVENT1( | 323 TRACE_EVENT1( |
| 325 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 324 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
| 326 DCHECK(Proxy::IsImplThread()); | 325 DCHECK(Proxy::IsImplThread()); |
| 327 UpdateBackgroundAnimateTicking(); | 326 UpdateBackgroundAnimateTicking(); |
| 328 if (scheduler_on_impl_thread_) | 327 if (scheduler_on_impl_thread_) |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 689 |
| 691 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 690 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
| 692 return timing_history_.CommitToActivateDurationEstimate(); | 691 return timing_history_.CommitToActivateDurationEstimate(); |
| 693 } | 692 } |
| 694 | 693 |
| 695 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 694 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
| 696 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 695 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 697 } | 696 } |
| 698 | 697 |
| 699 } // namespace cc | 698 } // namespace cc |
| OLD | NEW |