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/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 void LayerTreeHostImpl::BeginCommit() { | 289 void LayerTreeHostImpl::BeginCommit() { |
290 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); | 290 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); |
291 | 291 |
292 // Ensure all textures are returned so partial texture updates can happen | 292 // Ensure all textures are returned so partial texture updates can happen |
293 // during the commit. Impl-side-painting doesn't upload during commits, so | 293 // during the commit. Impl-side-painting doesn't upload during commits, so |
294 // is unaffected. | 294 // is unaffected. |
295 if (!settings_.impl_side_painting && output_surface_) | 295 if (!settings_.impl_side_painting && output_surface_) |
296 output_surface_->ForceReclaimResources(); | 296 output_surface_->ForceReclaimResources(); |
297 | 297 |
298 if (UsePendingTreeForSync()) | 298 if (settings_.impl_side_painting && !proxy_->CommitToActiveTree()) |
299 CreatePendingTree(); | 299 CreatePendingTree(); |
300 } | 300 } |
301 | 301 |
302 void LayerTreeHostImpl::CommitComplete() { | 302 void LayerTreeHostImpl::CommitComplete() { |
303 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 303 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
304 | 304 |
305 sync_tree()->set_needs_update_draw_properties(); | 305 sync_tree()->set_needs_update_draw_properties(); |
306 | 306 |
307 if (settings_.impl_side_painting) { | 307 if (settings_.impl_side_painting) { |
308 // Impl-side painting needs an update immediately post-commit to have the | 308 // Impl-side painting needs an update immediately post-commit to have the |
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 | 2065 |
2066 void LayerTreeHostImpl::DestroyTileManager() { | 2066 void LayerTreeHostImpl::DestroyTileManager() { |
2067 tile_manager_ = nullptr; | 2067 tile_manager_ = nullptr; |
2068 resource_pool_ = nullptr; | 2068 resource_pool_ = nullptr; |
2069 staging_resource_pool_ = nullptr; | 2069 staging_resource_pool_ = nullptr; |
2070 tile_task_worker_pool_ = nullptr; | 2070 tile_task_worker_pool_ = nullptr; |
2071 rasterizer_ = nullptr; | 2071 rasterizer_ = nullptr; |
2072 single_thread_synchronous_task_graph_runner_ = nullptr; | 2072 single_thread_synchronous_task_graph_runner_ = nullptr; |
2073 } | 2073 } |
2074 | 2074 |
2075 bool LayerTreeHostImpl::UsePendingTreeForSync() const { | |
2076 // In impl-side painting, synchronize to the pending tree so that it has | |
2077 // time to raster before being displayed. | |
2078 return settings_.impl_side_painting; | |
2079 } | |
2080 | |
2081 bool LayerTreeHostImpl::IsSynchronousSingleThreaded() const { | 2075 bool LayerTreeHostImpl::IsSynchronousSingleThreaded() const { |
2082 return !proxy_->HasImplThread() && !settings_.single_thread_proxy_scheduler; | 2076 return !proxy_->HasImplThread() && !settings_.single_thread_proxy_scheduler; |
2083 } | 2077 } |
2084 | 2078 |
2085 void LayerTreeHostImpl::EnforceZeroBudget(bool zero_budget) { | 2079 void LayerTreeHostImpl::EnforceZeroBudget(bool zero_budget) { |
2086 SetManagedMemoryPolicy(cached_managed_memory_policy_, zero_budget); | 2080 SetManagedMemoryPolicy(cached_managed_memory_policy_, zero_budget); |
2087 } | 2081 } |
2088 | 2082 |
2089 bool LayerTreeHostImpl::InitializeRenderer( | 2083 bool LayerTreeHostImpl::InitializeRenderer( |
2090 scoped_ptr<OutputSurface> output_surface) { | 2084 scoped_ptr<OutputSurface> output_surface) { |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3474 (*it)->OnSetNeedsRedrawOnImpl(); | 3468 (*it)->OnSetNeedsRedrawOnImpl(); |
3475 } | 3469 } |
3476 | 3470 |
3477 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { | 3471 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { |
3478 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3472 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3479 for (; it != swap_promise_monitor_.end(); it++) | 3473 for (; it != swap_promise_monitor_.end(); it++) |
3480 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); | 3474 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); |
3481 } | 3475 } |
3482 | 3476 |
3483 } // namespace cc | 3477 } // namespace cc |
OLD | NEW |