Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 } | 351 } |
| 352 | 352 |
| 353 // Aggressively remove any tilings that are not seen to save memory. Note | 353 // Aggressively remove any tilings that are not seen to save memory. Note |
| 354 // that this is at the expense of doing cause more frequent re-painting. A | 354 // that this is at the expense of doing cause more frequent re-painting. A |
| 355 // better scheme would be to maintain a tighter visible_content_rect for the | 355 // better scheme would be to maintain a tighter visible_content_rect for the |
| 356 // finer tilings. | 356 // finer tilings. |
| 357 CleanUpTilingsOnActiveLayer(seen_tilings); | 357 CleanUpTilingsOnActiveLayer(seen_tilings); |
| 358 } | 358 } |
| 359 | 359 |
| 360 void PictureLayerImpl::DidUnregisterLayer() { | 360 void PictureLayerImpl::DidUnregisterLayer() { |
| 361 TRACE_EVENT0("cc", "PictureLayerImpl::DidUnregisterLayer"); | |
| 362 | |
| 361 layer_needs_to_register_itself_ = true; | 363 layer_needs_to_register_itself_ = true; |
| 364 RemoveAllTilings(); | |
| 365 | |
| 366 // If we're on the pending tree, this means we might have an active twin | |
| 367 // layer. If we don't require that we sync from the active layer again, we | |
| 368 // might go through CalculateDrawProperties again, which will cause us to call | |
| 369 // ManageTilings. This, in turn, will create high and low res tilings for this | |
| 370 // layer and try to apply the same layer to the active tree. However, the | |
| 371 // active tree would already have these tilings, which would cause us to | |
| 372 // CHECK. As a workaround, this simply requires that this layer first syncs | |
| 373 // the tilings from the active tree before doing ManageTilings. | |
| 374 // TODO(vmpstr): This might not be a requirement once | |
| 375 // https://codereview.chromium.org/271533011 lands. | |
| 376 if (layer_tree_impl()->IsPendingTree()) { | |
| 377 if (twin_layer_) { | |
| 378 twin_layer_->twin_layer_ = NULL; | |
| 379 twin_layer_ = NULL; | |
| 380 } | |
| 381 needs_post_commit_initialization_ = true; | |
|
enne (OOO)
2014/05/15 17:41:32
:(
Just wait for https://codereview.chromium.org/
| |
| 382 } | |
| 362 } | 383 } |
| 363 | 384 |
| 364 void PictureLayerImpl::UpdateTilePriorities() { | 385 void PictureLayerImpl::UpdateTilePriorities() { |
| 386 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); | |
| 387 | |
| 388 DCHECK(IsDrawnRenderSurfaceLayerListMember()); | |
| 365 DCHECK(!needs_post_commit_initialization_); | 389 DCHECK(!needs_post_commit_initialization_); |
| 366 CHECK(should_update_tile_priorities_); | 390 CHECK(should_update_tile_priorities_); |
| 367 | 391 |
| 368 if (layer_needs_to_register_itself_) { | 392 if (layer_needs_to_register_itself_) { |
| 369 layer_tree_impl()->tile_manager()->RegisterPictureLayerImpl(this); | 393 layer_tree_impl()->tile_manager()->RegisterPictureLayerImpl(this); |
| 370 layer_needs_to_register_itself_ = false; | 394 layer_needs_to_register_itself_ = false; |
| 371 } | 395 } |
| 372 | 396 |
| 373 if (layer_tree_impl()->device_viewport_valid_for_tile_management()) { | 397 if (layer_tree_impl()->device_viewport_valid_for_tile_management()) { |
| 374 visible_rect_for_tile_priority_ = visible_content_rect(); | 398 visible_rect_for_tile_priority_ = visible_content_rect(); |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1557 return iterator_index_ < iterators_.size(); | 1581 return iterator_index_ < iterators_.size(); |
| 1558 } | 1582 } |
| 1559 | 1583 |
| 1560 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1584 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
| 1561 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1585 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
| 1562 return it->get_type() == iteration_stage_ && | 1586 return it->get_type() == iteration_stage_ && |
| 1563 (**it)->required_for_activation() == required_for_activation_; | 1587 (**it)->required_for_activation() == required_for_activation_; |
| 1564 } | 1588 } |
| 1565 | 1589 |
| 1566 } // namespace cc | 1590 } // namespace cc |
| OLD | NEW |