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 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // construct a DebugScopedSetImplThread object. There is no need to do | 99 // construct a DebugScopedSetImplThread object. There is no need to do |
100 // this in multi-threaded mode since the real thread id's will be | 100 // this in multi-threaded mode since the real thread id's will be |
101 // correct. In fact, setting fake thread id's interferes with the real | 101 // correct. In fact, setting fake thread id's interferes with the real |
102 // thread id's and causes breakage. | 102 // thread id's and causes breakage. |
103 scoped_ptr<DebugScopedSetImplThread> set_impl_thread; | 103 scoped_ptr<DebugScopedSetImplThread> set_impl_thread; |
104 if (!layer_tree_host_impl_->proxy()->HasImplThread()) { | 104 if (!layer_tree_host_impl_->proxy()->HasImplThread()) { |
105 set_impl_thread.reset( | 105 set_impl_thread.reset( |
106 new DebugScopedSetImplThread(layer_tree_host_impl_->proxy())); | 106 new DebugScopedSetImplThread(layer_tree_host_impl_->proxy())); |
107 } | 107 } |
108 | 108 |
109 // TODO(enne): This should probably happen post-animate. | |
110 if (layer_tree_host_impl_->pending_tree()) { | 109 if (layer_tree_host_impl_->pending_tree()) { |
111 layer_tree_host_impl_->ActivatePendingTreeIfNeeded(); | 110 layer_tree_host_impl_->ActivatePendingTreeIfNeeded(); |
112 | 111 |
113 if (layer_tree_host_impl_->pending_tree()) { | 112 if (layer_tree_host_impl_->pending_tree()) { |
114 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); | 113 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); |
115 layer_tree_host_impl_->ManageTiles(); | 114 layer_tree_host_impl_->ManageTiles(); |
116 } | 115 } |
117 } | 116 } |
118 | 117 |
119 layer_tree_host_impl_->Animate( | 118 layer_tree_host_impl_->Animate( |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 | 1405 |
1407 // Now that we've synced everything from the pending tree to the active | 1406 // Now that we've synced everything from the pending tree to the active |
1408 // tree, rename the pending tree the recycle tree so we can reuse it on the | 1407 // tree, rename the pending tree the recycle tree so we can reuse it on the |
1409 // next sync. | 1408 // next sync. |
1410 pending_tree_.swap(recycle_tree_); | 1409 pending_tree_.swap(recycle_tree_); |
1411 | 1410 |
1412 active_tree_->SetRootLayerScrollOffsetDelegate( | 1411 active_tree_->SetRootLayerScrollOffsetDelegate( |
1413 root_layer_scroll_offset_delegate_); | 1412 root_layer_scroll_offset_delegate_); |
1414 active_tree_->DidBecomeActive(); | 1413 active_tree_->DidBecomeActive(); |
1415 | 1414 |
| 1415 client_->DidActivatePendingTree(); |
| 1416 |
1416 // Reduce wasted memory now that unlinked resources are guaranteed not | 1417 // Reduce wasted memory now that unlinked resources are guaranteed not |
1417 // to be used. | 1418 // to be used. |
1418 client_->ReduceWastedContentsTextureMemoryOnImplThread(); | 1419 client_->ReduceWastedContentsTextureMemoryOnImplThread(); |
1419 | 1420 |
1420 client_->OnCanDrawStateChanged(CanDraw()); | 1421 client_->OnCanDrawStateChanged(CanDraw()); |
1421 client_->OnHasPendingTreeStateChanged(pending_tree_); | 1422 client_->OnHasPendingTreeStateChanged(pending_tree_); |
1422 client_->SetNeedsRedrawOnImplThread(); | 1423 client_->SetNeedsRedrawOnImplThread(); |
1423 client_->RenewTreePriority(); | 1424 client_->RenewTreePriority(); |
1424 | 1425 |
1425 if (debug_state_.continuous_painting) { | 1426 if (debug_state_.continuous_painting) { |
1426 const RenderingStats& stats = | 1427 const RenderingStats& stats = |
1427 rendering_stats_instrumentation_->GetRenderingStats(); | 1428 rendering_stats_instrumentation_->GetRenderingStats(); |
1428 paint_time_counter_->SavePaintTime( | 1429 paint_time_counter_->SavePaintTime( |
1429 stats.total_paint_time + stats.total_record_time + | 1430 stats.total_paint_time + stats.total_record_time + |
1430 stats.total_rasterize_time_for_now_bins_on_pending_tree); | 1431 stats.total_rasterize_time_for_now_bins_on_pending_tree); |
1431 } | 1432 } |
1432 | |
1433 client_->DidActivatePendingTree(); | |
1434 } | 1433 } |
1435 | 1434 |
1436 void LayerTreeHostImpl::SetVisible(bool visible) { | 1435 void LayerTreeHostImpl::SetVisible(bool visible) { |
1437 DCHECK(proxy_->IsImplThread()); | 1436 DCHECK(proxy_->IsImplThread()); |
1438 | 1437 |
1439 if (visible_ == visible) | 1438 if (visible_ == visible) |
1440 return; | 1439 return; |
1441 visible_ = visible; | 1440 visible_ = visible; |
1442 DidVisibilityChange(this, visible_); | 1441 DidVisibilityChange(this, visible_); |
1443 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); | 1442 EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 } | 2355 } |
2357 | 2356 |
2358 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2357 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
2359 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2358 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
2360 paint_time_counter_->ClearHistory(); | 2359 paint_time_counter_->ClearHistory(); |
2361 | 2360 |
2362 debug_state_ = debug_state; | 2361 debug_state_ = debug_state; |
2363 } | 2362 } |
2364 | 2363 |
2365 } // namespace cc | 2364 } // namespace cc |
OLD | NEW |