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/base/thread.h" | |
10 #include "cc/output/context_provider.h" | 9 #include "cc/output/context_provider.h" |
11 #include "cc/output/output_surface.h" | 10 #include "cc/output/output_surface.h" |
12 #include "cc/quads/draw_quad.h" | 11 #include "cc/quads/draw_quad.h" |
13 #include "cc/resources/prioritized_resource_manager.h" | 12 #include "cc/resources/prioritized_resource_manager.h" |
14 #include "cc/resources/resource_update_controller.h" | 13 #include "cc/resources/resource_update_controller.h" |
15 #include "cc/trees/layer_tree_host.h" | 14 #include "cc/trees/layer_tree_host.h" |
16 #include "cc/trees/layer_tree_impl.h" | 15 #include "cc/trees/layer_tree_impl.h" |
17 | 16 |
18 namespace cc { | 17 namespace cc { |
19 | 18 |
20 scoped_ptr<Proxy> SingleThreadProxy::Create(LayerTreeHost* layer_tree_host) { | 19 scoped_ptr<Proxy> SingleThreadProxy::Create(LayerTreeHost* layer_tree_host) { |
21 return make_scoped_ptr( | 20 return make_scoped_ptr( |
22 new SingleThreadProxy(layer_tree_host)).PassAs<Proxy>(); | 21 new SingleThreadProxy(layer_tree_host)).PassAs<Proxy>(); |
23 } | 22 } |
24 | 23 |
25 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host) | 24 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host) |
26 : Proxy(scoped_ptr<Thread>()), | 25 : Proxy(NULL), |
27 layer_tree_host_(layer_tree_host), | 26 layer_tree_host_(layer_tree_host), |
28 created_offscreen_context_provider_(false), | 27 created_offscreen_context_provider_(false), |
29 next_frame_is_newly_committed_frame_(false), | 28 next_frame_is_newly_committed_frame_(false), |
30 inside_draw_(false) { | 29 inside_draw_(false) { |
31 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); | 30 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
32 DCHECK(Proxy::IsMainThread()); | 31 DCHECK(Proxy::IsMainThread()); |
33 DCHECK(layer_tree_host); | 32 DCHECK(layer_tree_host); |
34 | 33 |
35 // Impl-side painting not supported without threaded compositing. | 34 // Impl-side painting not supported without threaded compositing. |
36 CHECK(!layer_tree_host->settings().impl_side_painting) | 35 CHECK(!layer_tree_host->settings().impl_side_painting) |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 186 |
188 if (layer_tree_host_->contents_texture_manager()) { | 187 if (layer_tree_host_->contents_texture_manager()) { |
189 layer_tree_host_->contents_texture_manager()-> | 188 layer_tree_host_->contents_texture_manager()-> |
190 PushTexturePrioritiesToBackings(); | 189 PushTexturePrioritiesToBackings(); |
191 } | 190 } |
192 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); | 191 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); |
193 | 192 |
194 scoped_ptr<ResourceUpdateController> update_controller = | 193 scoped_ptr<ResourceUpdateController> update_controller = |
195 ResourceUpdateController::Create( | 194 ResourceUpdateController::Create( |
196 NULL, | 195 NULL, |
197 Proxy::MainThread()->TaskRunner(), | 196 Proxy::MainThreadTaskRunner(), |
198 queue.Pass(), | 197 queue.Pass(), |
199 layer_tree_host_impl_->resource_provider()); | 198 layer_tree_host_impl_->resource_provider()); |
200 update_controller->Finalize(); | 199 update_controller->Finalize(); |
201 | 200 |
202 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); | 201 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); |
203 | 202 |
204 layer_tree_host_impl_->CommitComplete(); | 203 layer_tree_host_impl_->CommitComplete(); |
205 | 204 |
206 #ifndef NDEBUG | 205 #ifndef NDEBUG |
207 // In the single-threaded case, the scroll deltas should never be | 206 // In the single-threaded case, the scroll deltas should never be |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 485 |
487 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 486 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
488 | 487 |
489 skia::RefPtr<SkPicture> SingleThreadProxy::CapturePicture() { | 488 skia::RefPtr<SkPicture> SingleThreadProxy::CapturePicture() { |
490 // Impl-side painting only. | 489 // Impl-side painting only. |
491 NOTREACHED(); | 490 NOTREACHED(); |
492 return skia::RefPtr<SkPicture>(); | 491 return skia::RefPtr<SkPicture>(); |
493 } | 492 } |
494 | 493 |
495 } // namespace cc | 494 } // namespace cc |
OLD | NEW |