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

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

Issue 16160005: cc: Ignore offscreen tiles for activation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test Created 7 years, 6 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
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 high_res = tiling; 677 high_res = tiling;
678 continue; 678 continue;
679 } 679 }
680 for (PictureLayerTiling::CoverageIterator iter(tiling, 680 for (PictureLayerTiling::CoverageIterator iter(tiling,
681 contents_scale_x(), 681 contents_scale_x(),
682 rect); 682 rect);
683 iter; 683 iter;
684 ++iter) { 684 ++iter) {
685 if (!*iter || !iter->tile_version().IsReadyToDraw()) 685 if (!*iter || !iter->tile_version().IsReadyToDraw())
686 continue; 686 continue;
687
688 // This iteration is over the visible content rect which is potentially
689 // less conservative than projecting the viewport into the layer.
690 // Ignore tiles that are know to be outside the viewport.
691 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0)
692 continue;
693
687 missing_region.Subtract(iter.geometry_rect()); 694 missing_region.Subtract(iter.geometry_rect());
688 iter->mark_required_for_activation(); 695 iter->mark_required_for_activation();
689
690 DCHECK_EQ(iter->priority(PENDING_TREE).distance_to_visible_in_pixels, 0);
691 DCHECK_EQ(iter->priority(PENDING_TREE).time_to_visible_in_seconds, 0);
692 } 696 }
693 } 697 }
694 698
695 DCHECK(high_res) << "There must be one high res tiling"; 699 DCHECK(high_res) << "There must be one high res tiling";
696 for (PictureLayerTiling::CoverageIterator iter(high_res, 700 for (PictureLayerTiling::CoverageIterator iter(high_res,
697 contents_scale_x(), 701 contents_scale_x(),
698 rect); 702 rect);
699 iter; 703 iter;
700 ++iter) { 704 ++iter) {
701 // A null tile (i.e. missing recording) can just be skipped. 705 // A null tile (i.e. missing recording) can just be skipped.
706 if (!*iter)
707 continue;
708
709 // This iteration is over the visible content rect which is potentially
710 // less conservative than projecting the viewport into the layer.
711 // Ignore tiles that are know to be outside the viewport.
712 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0)
713 continue;
714
702 // If the missing region doesn't cover it, this tile is fully 715 // If the missing region doesn't cover it, this tile is fully
703 // covered by acceptable tiles at other scales. 716 // covered by acceptable tiles at other scales.
704 if (!*iter || !missing_region.Intersects(iter.geometry_rect())) 717 if (!missing_region.Intersects(iter.geometry_rect()))
705 continue; 718 continue;
719
706 iter->mark_required_for_activation(); 720 iter->mark_required_for_activation();
707
708 // These must be true for this tile to end up in the NOW_BIN in TileManager.
709 DCHECK_EQ(iter->priority(PENDING_TREE).distance_to_visible_in_pixels, 0);
710 DCHECK_EQ(iter->priority(PENDING_TREE).time_to_visible_in_seconds, 0);
711 } 721 }
712 } 722 }
713 723
714 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { 724 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
715 DCHECK(CanHaveTilingWithScale(contents_scale)) << 725 DCHECK(CanHaveTilingWithScale(contents_scale)) <<
716 "contents_scale: " << contents_scale; 726 "contents_scale: " << contents_scale;
717 727
718 PictureLayerTiling* tiling = tilings_->AddTiling(contents_scale); 728 PictureLayerTiling* tiling = tilings_->AddTiling(contents_scale);
719 729
720 const Region& recorded = pile_->recorded_region(); 730 const Region& recorded = pile_->recorded_region();
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 state->Set("tilings", tilings_->AsValue().release()); 1024 state->Set("tilings", tilings_->AsValue().release());
1015 state->Set("pictures", pile_->AsValue().release()); 1025 state->Set("pictures", pile_->AsValue().release());
1016 state->Set("invalidation", invalidation_.AsValue().release()); 1026 state->Set("invalidation", invalidation_.AsValue().release());
1017 } 1027 }
1018 1028
1019 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { 1029 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const {
1020 return tilings_->GPUMemoryUsageInBytes(); 1030 return tilings_->GPUMemoryUsageInBytes();
1021 } 1031 }
1022 1032
1023 } // namespace cc 1033 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698