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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1188 void LayerTreeHostImpl::DidModifyTilePriorities() { | 1188 void LayerTreeHostImpl::DidModifyTilePriorities() { |
1189 DCHECK(settings_.impl_side_painting); | 1189 DCHECK(settings_.impl_side_painting); |
1190 // Mark priorities as dirty and schedule a ManageTiles(). | 1190 // Mark priorities as dirty and schedule a ManageTiles(). |
1191 tile_priorities_dirty_ = true; | 1191 tile_priorities_dirty_ = true; |
1192 client_->SetNeedsManageTilesOnImplThread(); | 1192 client_->SetNeedsManageTilesOnImplThread(); |
1193 } | 1193 } |
1194 | 1194 |
1195 void LayerTreeHostImpl::DidInitializeVisibleTile() { | 1195 void LayerTreeHostImpl::DidInitializeVisibleTile() { |
1196 // TODO(reveman): Determine tiles that changed and only damage | 1196 // TODO(reveman): Determine tiles that changed and only damage |
1197 // what's necessary. | 1197 // what's necessary. |
1198 SetFullRootLayerDamage(); | 1198 gfx::Rect rect = tile_manager_->GetDamagedRect(); |
1199 if (rect.width() * rect.height() <= | |
1200 DrawViewportSize().width() * DrawViewportSize().height()) | |
sohanjg
2014/04/01 12:03:11
we may optimize this check.
| |
1201 SetViewportDamage(rect); | |
1202 else | |
1203 SetFullRootLayerDamage(); | |
1204 tile_manager_->ResetDamagedRect(); | |
1205 | |
1199 if (client_ && !client_->IsInsideDraw()) | 1206 if (client_ && !client_->IsInsideDraw()) |
1200 client_->DidInitializeVisibleTileOnImplThread(); | 1207 client_->DidInitializeVisibleTileOnImplThread(); |
1201 } | 1208 } |
1202 | 1209 |
1203 void LayerTreeHostImpl::NotifyReadyToActivate() { | 1210 void LayerTreeHostImpl::NotifyReadyToActivate() { |
1204 client_->NotifyReadyToActivate(); | 1211 client_->NotifyReadyToActivate(); |
1205 } | 1212 } |
1206 | 1213 |
1207 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { | 1214 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { |
1208 SetManagedMemoryPolicy(policy, zero_budget_); | 1215 SetManagedMemoryPolicy(policy, zero_budget_); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1585 CHECK(!pending_tree_); | 1592 CHECK(!pending_tree_); |
1586 if (recycle_tree_) | 1593 if (recycle_tree_) |
1587 recycle_tree_.swap(pending_tree_); | 1594 recycle_tree_.swap(pending_tree_); |
1588 else | 1595 else |
1589 pending_tree_ = LayerTreeImpl::create(this); | 1596 pending_tree_ = LayerTreeImpl::create(this); |
1590 client_->OnCanDrawStateChanged(CanDraw()); | 1597 client_->OnCanDrawStateChanged(CanDraw()); |
1591 TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree:waiting", pending_tree_.get()); | 1598 TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree:waiting", pending_tree_.get()); |
1592 } | 1599 } |
1593 | 1600 |
1594 void LayerTreeHostImpl::UpdateVisibleTiles() { | 1601 void LayerTreeHostImpl::UpdateVisibleTiles() { |
1595 if (tile_manager_ && tile_manager_->UpdateVisibleTiles()) | 1602 if (tile_manager_ && tile_manager_->UpdateVisibleTiles()) { |
1596 DidInitializeVisibleTile(); | 1603 DidInitializeVisibleTile(); |
1604 } | |
1597 need_to_update_visible_tiles_before_draw_ = false; | 1605 need_to_update_visible_tiles_before_draw_ = false; |
1598 } | 1606 } |
1599 | 1607 |
1600 void LayerTreeHostImpl::ActivatePendingTree() { | 1608 void LayerTreeHostImpl::ActivatePendingTree() { |
1601 CHECK(pending_tree_); | 1609 CHECK(pending_tree_); |
1602 TRACE_EVENT_ASYNC_END0("cc", "PendingTree:waiting", pending_tree_.get()); | 1610 TRACE_EVENT_ASYNC_END0("cc", "PendingTree:waiting", pending_tree_.get()); |
1603 | 1611 |
1604 need_to_update_visible_tiles_before_draw_ = true; | 1612 need_to_update_visible_tiles_before_draw_ = true; |
1605 | 1613 |
1606 active_tree_->SetRootLayerScrollOffsetDelegate(NULL); | 1614 active_tree_->SetRootLayerScrollOffsetDelegate(NULL); |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3019 swap_promise_monitor_.erase(monitor); | 3027 swap_promise_monitor_.erase(monitor); |
3020 } | 3028 } |
3021 | 3029 |
3022 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3030 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3023 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3031 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3024 for (; it != swap_promise_monitor_.end(); it++) | 3032 for (; it != swap_promise_monitor_.end(); it++) |
3025 (*it)->OnSetNeedsRedrawOnImpl(); | 3033 (*it)->OnSetNeedsRedrawOnImpl(); |
3026 } | 3034 } |
3027 | 3035 |
3028 } // namespace cc | 3036 } // namespace cc |
OLD | NEW |