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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 | 1124 |
1125 void LayerTreeHostImpl::EvictTexturesForTesting() { | 1125 void LayerTreeHostImpl::EvictTexturesForTesting() { |
1126 EnforceManagedMemoryPolicy(ManagedMemoryPolicy(0)); | 1126 EnforceManagedMemoryPolicy(ManagedMemoryPolicy(0)); |
1127 } | 1127 } |
1128 | 1128 |
1129 void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) { | 1129 void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) { |
1130 NOTREACHED(); | 1130 NOTREACHED(); |
1131 } | 1131 } |
1132 | 1132 |
1133 void LayerTreeHostImpl::DidInitializeVisibleTileForTesting() { | 1133 void LayerTreeHostImpl::DidInitializeVisibleTileForTesting() { |
| 1134 // Add arbitrary damage, to trigger prepare-to-draws. |
| 1135 // Here, setting damage as viewport size, used only for testing. |
| 1136 SetFullRootLayerDamage(); |
1134 DidInitializeVisibleTile(); | 1137 DidInitializeVisibleTile(); |
1135 } | 1138 } |
1136 | 1139 |
1137 void LayerTreeHostImpl::EnforceManagedMemoryPolicy( | 1140 void LayerTreeHostImpl::EnforceManagedMemoryPolicy( |
1138 const ManagedMemoryPolicy& policy) { | 1141 const ManagedMemoryPolicy& policy) { |
1139 | 1142 |
1140 bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread( | 1143 bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread( |
1141 visible_ ? policy.bytes_limit_when_visible : 0, | 1144 visible_ ? policy.bytes_limit_when_visible : 0, |
1142 ManagedMemoryPolicy::PriorityCutoffToValue( | 1145 ManagedMemoryPolicy::PriorityCutoffToValue( |
1143 visible_ ? policy.priority_cutoff_when_visible | 1146 visible_ ? policy.priority_cutoff_when_visible |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 } | 1202 } |
1200 | 1203 |
1201 void LayerTreeHostImpl::DidModifyTilePriorities() { | 1204 void LayerTreeHostImpl::DidModifyTilePriorities() { |
1202 DCHECK(settings_.impl_side_painting); | 1205 DCHECK(settings_.impl_side_painting); |
1203 // Mark priorities as dirty and schedule a ManageTiles(). | 1206 // Mark priorities as dirty and schedule a ManageTiles(). |
1204 tile_priorities_dirty_ = true; | 1207 tile_priorities_dirty_ = true; |
1205 client_->SetNeedsManageTilesOnImplThread(); | 1208 client_->SetNeedsManageTilesOnImplThread(); |
1206 } | 1209 } |
1207 | 1210 |
1208 void LayerTreeHostImpl::DidInitializeVisibleTile() { | 1211 void LayerTreeHostImpl::DidInitializeVisibleTile() { |
1209 // TODO(reveman): Determine tiles that changed and only damage | |
1210 // what's necessary. | |
1211 SetFullRootLayerDamage(); | |
1212 if (client_ && !client_->IsInsideDraw()) | 1212 if (client_ && !client_->IsInsideDraw()) |
1213 client_->DidInitializeVisibleTileOnImplThread(); | 1213 client_->DidInitializeVisibleTileOnImplThread(); |
1214 } | 1214 } |
1215 | 1215 |
1216 void LayerTreeHostImpl::NotifyReadyToActivate() { | 1216 void LayerTreeHostImpl::NotifyReadyToActivate() { |
1217 client_->NotifyReadyToActivate(); | 1217 client_->NotifyReadyToActivate(); |
1218 } | 1218 } |
1219 | 1219 |
| 1220 void LayerTreeHostImpl::NotifyTileInitialized(const Tile* tile) { |
| 1221 if (!active_tree_) |
| 1222 return; |
| 1223 |
| 1224 LayerImpl* layer_impl = |
| 1225 active_tree_->FindActiveTreeLayerById(tile->layer_id()); |
| 1226 if (layer_impl) { |
| 1227 gfx::RectF layer_damage_rect = |
| 1228 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); |
| 1229 layer_impl->AddDamageRect(layer_damage_rect); |
| 1230 } |
| 1231 } |
| 1232 |
1220 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { | 1233 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { |
1221 SetManagedMemoryPolicy(policy, zero_budget_); | 1234 SetManagedMemoryPolicy(policy, zero_budget_); |
1222 } | 1235 } |
1223 | 1236 |
1224 void LayerTreeHostImpl::SetTreeActivationCallback( | 1237 void LayerTreeHostImpl::SetTreeActivationCallback( |
1225 const base::Closure& callback) { | 1238 const base::Closure& callback) { |
1226 DCHECK(proxy_->IsImplThread()); | 1239 DCHECK(proxy_->IsImplThread()); |
1227 DCHECK(settings_.impl_side_painting || callback.is_null()); | 1240 DCHECK(settings_.impl_side_painting || callback.is_null()); |
1228 tree_activation_callback_ = callback; | 1241 tree_activation_callback_ = callback; |
1229 } | 1242 } |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3057 swap_promise_monitor_.erase(monitor); | 3070 swap_promise_monitor_.erase(monitor); |
3058 } | 3071 } |
3059 | 3072 |
3060 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3073 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3061 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3074 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3062 for (; it != swap_promise_monitor_.end(); it++) | 3075 for (; it != swap_promise_monitor_.end(); it++) |
3063 (*it)->OnSetNeedsRedrawOnImpl(); | 3076 (*it)->OnSetNeedsRedrawOnImpl(); |
3064 } | 3077 } |
3065 | 3078 |
3066 } // namespace cc | 3079 } // namespace cc |
OLD | NEW |