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 "ui/gfx/frame_time.h" | 19 #include "ui/gfx/frame_time.h" |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 | 22 |
23 scoped_ptr<Proxy> SingleThreadProxy::Create( | 23 scoped_ptr<Proxy> SingleThreadProxy::Create( |
24 LayerTreeHost* layer_tree_host, | 24 LayerTreeHost* layer_tree_host, |
25 LayerTreeHostSingleThreadClient* client) { | 25 LayerTreeHostSingleThreadClient* client, |
| 26 scoped_refptr<cc::MainThreadTaskRunner> main_task_runner) { |
26 return make_scoped_ptr( | 27 return make_scoped_ptr( |
27 new SingleThreadProxy(layer_tree_host, client)).PassAs<Proxy>(); | 28 new SingleThreadProxy(layer_tree_host, client, main_task_runner)) |
| 29 .PassAs<Proxy>(); |
28 } | 30 } |
29 | 31 |
30 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host, | 32 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host, |
31 LayerTreeHostSingleThreadClient* client) | 33 LayerTreeHostSingleThreadClient* client, |
32 : Proxy(NULL), | 34 scoped_refptr<cc::MainThreadTaskRunner> main_task_runner) |
| 35 : Proxy(main_task_runner, NULL), |
33 layer_tree_host_(layer_tree_host), | 36 layer_tree_host_(layer_tree_host), |
34 client_(client), | 37 client_(client), |
35 next_frame_is_newly_committed_frame_(false), | 38 next_frame_is_newly_committed_frame_(false), |
36 inside_draw_(false) { | 39 inside_draw_(false) { |
37 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); | 40 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
38 DCHECK(Proxy::IsMainThread()); | 41 DCHECK(Proxy::IsMainThread()); |
39 DCHECK(layer_tree_host); | 42 DCHECK(layer_tree_host); |
40 | 43 |
41 // Impl-side painting not supported without threaded compositing. | 44 // Impl-side painting not supported without threaded compositing. |
42 CHECK(!layer_tree_host->settings().impl_side_painting) | 45 CHECK(!layer_tree_host->settings().impl_side_painting) |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 void SingleThreadProxy::DidSwapFrame() { | 458 void SingleThreadProxy::DidSwapFrame() { |
456 if (next_frame_is_newly_committed_frame_) { | 459 if (next_frame_is_newly_committed_frame_) { |
457 next_frame_is_newly_committed_frame_ = false; | 460 next_frame_is_newly_committed_frame_ = false; |
458 layer_tree_host_->DidCommitAndDrawFrame(); | 461 layer_tree_host_->DidCommitAndDrawFrame(); |
459 } | 462 } |
460 } | 463 } |
461 | 464 |
462 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 465 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
463 | 466 |
464 } // namespace cc | 467 } // namespace cc |
OLD | NEW |