Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 374653003: Track occlusion per tree on Tile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 contents_scale, 876 contents_scale,
877 rect); 877 rect);
878 iter; 878 iter;
879 ++iter) { 879 ++iter) {
880 Tile* tile = *iter; 880 Tile* tile = *iter;
881 // A null tile (i.e. missing recording) can just be skipped. 881 // A null tile (i.e. missing recording) can just be skipped.
882 if (!tile) 882 if (!tile)
883 continue; 883 continue;
884 884
885 // If the tile is occluded, don't mark it as required for activation. 885 // If the tile is occluded, don't mark it as required for activation.
886 if (tile->is_occluded()) 886 WhichTree tree =
danakj 2014/07/07 19:26:28 This method should only be called on the pending t
jbedley 2014/07/07 20:25:13 Done.
887 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
888 if (tile->is_occluded(tree))
887 continue; 889 continue;
888 890
889 // If the missing region doesn't cover it, this tile is fully 891 // If the missing region doesn't cover it, this tile is fully
890 // covered by acceptable tiles at other scales. 892 // covered by acceptable tiles at other scales.
891 if (!missing_region.Intersects(iter.geometry_rect())) 893 if (!missing_region.Intersects(iter.geometry_rect()))
892 continue; 894 continue;
893 895
894 // If the twin tile doesn't exist (i.e. missing recording or so far away 896 // If the twin tile doesn't exist (i.e. missing recording or so far away
895 // that it is outside the visible tile rect) or this tile is shared between 897 // that it is outside the visible tile rect) or this tile is shared between
896 // with the twin, then this tile isn't required to prevent flashing. 898 // with the twin, then this tile isn't required to prevent flashing.
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 1456
1455 stages_[2].iterator_type = HIGH_RES; 1457 stages_[2].iterator_type = HIGH_RES;
1456 stages_[2].tile_type = TilePriority::SOON; 1458 stages_[2].tile_type = TilePriority::SOON;
1457 1459
1458 stages_[3].iterator_type = HIGH_RES; 1460 stages_[3].iterator_type = HIGH_RES;
1459 stages_[3].tile_type = TilePriority::EVENTUALLY; 1461 stages_[3].tile_type = TilePriority::EVENTUALLY;
1460 1462
1461 IteratorType index = stages_[current_stage_].iterator_type; 1463 IteratorType index = stages_[current_stage_].iterator_type;
1462 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; 1464 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type;
1463 if (!iterators_[index] || iterators_[index].get_type() != tile_type || 1465 if (!iterators_[index] || iterators_[index].get_type() != tile_type ||
1464 (*iterators_[index])->is_occluded()) 1466 (*iterators_[index])->is_occluded(tree))
1465 ++(*this); 1467 ++(*this);
1466 } 1468 }
1467 1469
1468 PictureLayerImpl::LayerRasterTileIterator::~LayerRasterTileIterator() {} 1470 PictureLayerImpl::LayerRasterTileIterator::~LayerRasterTileIterator() {}
1469 1471
1470 PictureLayerImpl::LayerRasterTileIterator::operator bool() const { 1472 PictureLayerImpl::LayerRasterTileIterator::operator bool() const {
1471 return layer_ && static_cast<size_t>(current_stage_) < arraysize(stages_); 1473 return layer_ && static_cast<size_t>(current_stage_) < arraysize(stages_);
1472 } 1474 }
1473 1475
1474 PictureLayerImpl::LayerRasterTileIterator& 1476 PictureLayerImpl::LayerRasterTileIterator&
1475 PictureLayerImpl::LayerRasterTileIterator:: 1477 PictureLayerImpl::LayerRasterTileIterator::
1476 operator++() { 1478 operator++() {
1479 WhichTree tree =
1480 layer_->layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
1481
1477 IteratorType index = stages_[current_stage_].iterator_type; 1482 IteratorType index = stages_[current_stage_].iterator_type;
1478 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; 1483 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type;
1479 1484
1480 // First advance the iterator. 1485 // First advance the iterator.
1481 if (iterators_[index]) 1486 if (iterators_[index])
1482 ++iterators_[index]; 1487 ++iterators_[index];
1483 1488
1484 while (iterators_[index] && iterators_[index].get_type() == tile_type && 1489 while (iterators_[index] && iterators_[index].get_type() == tile_type &&
1485 (*iterators_[index])->is_occluded()) 1490 (*iterators_[index])->is_occluded(tree))
1486 ++iterators_[index]; 1491 ++iterators_[index];
1487 1492
1488 if (iterators_[index] && iterators_[index].get_type() == tile_type) 1493 if (iterators_[index] && iterators_[index].get_type() == tile_type)
1489 return *this; 1494 return *this;
1490 1495
1491 // Next, advance the stage. 1496 // Next, advance the stage.
1492 int stage_count = arraysize(stages_); 1497 int stage_count = arraysize(stages_);
1493 ++current_stage_; 1498 ++current_stage_;
1494 while (current_stage_ < stage_count) { 1499 while (current_stage_ < stage_count) {
1495 index = stages_[current_stage_].iterator_type; 1500 index = stages_[current_stage_].iterator_type;
1496 tile_type = stages_[current_stage_].tile_type; 1501 tile_type = stages_[current_stage_].tile_type;
1497 1502
1498 if (iterators_[index] && iterators_[index].get_type() == tile_type && 1503 if (iterators_[index] && iterators_[index].get_type() == tile_type &&
1499 !(*iterators_[index])->is_occluded()) 1504 !(*iterators_[index])->is_occluded(tree))
1500 break; 1505 break;
1501 ++current_stage_; 1506 ++current_stage_;
1502 } 1507 }
1503 return *this; 1508 return *this;
1504 } 1509 }
1505 1510
1506 Tile* PictureLayerImpl::LayerRasterTileIterator::operator*() { 1511 Tile* PictureLayerImpl::LayerRasterTileIterator::operator*() {
1507 DCHECK(*this); 1512 DCHECK(*this);
1508 1513
1509 IteratorType index = stages_[current_stage_].iterator_type; 1514 IteratorType index = stages_[current_stage_].iterator_type;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 return iterator_index_ < iterators_.size(); 1639 return iterator_index_ < iterators_.size();
1635 } 1640 }
1636 1641
1637 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1642 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1638 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1643 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1639 return it->get_type() == iteration_stage_ && 1644 return it->get_type() == iteration_stage_ &&
1640 (**it)->required_for_activation() == required_for_activation_; 1645 (**it)->required_for_activation() == required_for_activation_;
1641 } 1646 }
1642 1647
1643 } // namespace cc 1648 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | cc/layers/picture_layer_impl_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698