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>(); |
30 } | 31 } |
31 | 32 |
32 SingleThreadProxy::SingleThreadProxy( | 33 SingleThreadProxy::SingleThreadProxy( |
33 LayerTreeHost* layer_tree_host, | 34 LayerTreeHost* layer_tree_host, |
34 LayerTreeHostSingleThreadClient* client, | 35 LayerTreeHostSingleThreadClient* client, |
35 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) | 36 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) |
36 : Proxy(main_task_runner, NULL), | 37 : Proxy(main_task_runner, NULL), |
37 layer_tree_host_(layer_tree_host), | 38 layer_tree_host_(layer_tree_host), |
38 client_(client), | 39 client_(client), |
39 timing_history_(layer_tree_host->rendering_stats_instrumentation()), | 40 timing_history_(layer_tree_host->rendering_stats_instrumentation()), |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); | 307 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); |
307 DCHECK(Proxy::IsMainThread()); | 308 DCHECK(Proxy::IsMainThread()); |
308 { | 309 { |
309 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 310 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
310 DebugScopedSetImplThread impl(this); | 311 DebugScopedSetImplThread impl(this); |
311 | 312 |
312 BlockingTaskRunner::CapturePostTasks blocked( | 313 BlockingTaskRunner::CapturePostTasks blocked( |
313 blocking_main_thread_task_runner()); | 314 blocking_main_thread_task_runner()); |
314 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 315 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
315 layer_tree_host_impl_->resource_provider()); | 316 layer_tree_host_impl_->resource_provider()); |
316 scheduler_on_impl_thread_ = nullptr; | 317 scheduler_on_impl_thread_.reset(); |
317 layer_tree_host_impl_ = nullptr; | 318 layer_tree_host_impl_.reset(); |
318 } | 319 } |
319 layer_tree_host_ = NULL; | 320 layer_tree_host_ = NULL; |
320 } | 321 } |
321 | 322 |
322 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 323 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
323 TRACE_EVENT1( | 324 TRACE_EVENT1( |
324 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 325 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
325 DCHECK(Proxy::IsImplThread()); | 326 DCHECK(Proxy::IsImplThread()); |
326 UpdateBackgroundAnimateTicking(); | 327 UpdateBackgroundAnimateTicking(); |
327 if (scheduler_on_impl_thread_) | 328 if (scheduler_on_impl_thread_) |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 690 |
690 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 691 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
691 return timing_history_.CommitToActivateDurationEstimate(); | 692 return timing_history_.CommitToActivateDurationEstimate(); |
692 } | 693 } |
693 | 694 |
694 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 695 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
695 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 696 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
696 } | 697 } |
697 | 698 |
698 } // namespace cc | 699 } // namespace cc |
OLD | NEW |