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

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

Issue 260963008: Fixing crash in PictureLayerImpl::MarkVisibleResourcesAsRequired when low-res tiles are disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remaking if condition Created 6 years, 7 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
« 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 #include <limits> 8 #include <limits>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 DCHECK(high_res) << "There must be one high res tiling"; 780 DCHECK(high_res) << "There must be one high res tiling";
781 781
782 // If these pointers are null (because no twin, no matching tiling, or the 782 // If these pointers are null (because no twin, no matching tiling, or the
783 // simpification just below), then high res tiles will be required to fill any 783 // simpification just below), then high res tiles will be required to fill any
784 // holes left by the first pass above. If the pointers are valid, then this 784 // holes left by the first pass above. If the pointers are valid, then this
785 // layer is allowed to skip any tiles that are not ready on its twin. 785 // layer is allowed to skip any tiles that are not ready on its twin.
786 const PictureLayerTiling* twin_high_res = NULL; 786 const PictureLayerTiling* twin_high_res = NULL;
787 const PictureLayerTiling* twin_low_res = NULL; 787 const PictureLayerTiling* twin_low_res = NULL;
788 788
789 // As a simplification, only allow activating to skip twin tiles that the 789 // As a simplification, only allow activating to skip twin tiles that the
790 // active layer is also missing when both this layer and its twin have 2 790 // active layer is also missing when both this layer and its twin have
791 // tilings (high and low). This avoids having to iterate/track coverage of 791 // "simple" sets of tilings: only 2 tilings (high and low) for case, when low
792 // non-ideal tilings during the last draw call on the active layer. 792 // res is enabled; or only 1 high res tiling, when low res is disabled. This
793 if (high_res && low_res && tilings_->num_tilings() == 2 && 793 // avoids having to iterate/track coverage of non-ideal tilings during the
794 twin_layer_ && twin_layer_->tilings_->num_tilings() == 2) { 794 // last draw call on the active layer.
795 twin_low_res = GetTwinTiling(low_res); 795 bool should_have_low_res = ShouldHaveLowResTiling();
796 if (twin_low_res) 796 int num_tilings = tilings_->num_tilings();
797 if ((high_res && low_res && num_tilings == 2 ||
798 high_res && !should_have_low_res && num_tilings == 1) &&
Sergey 2014/05/16 02:26:13 How about this one, did it get any better?... Or p
799 twin_layer_ && num_tilings == twin_layer_->tilings_->num_tilings()) {
800 if (should_have_low_res)
801 twin_low_res = GetTwinTiling(low_res);
802 if (twin_low_res || !should_have_low_res)
797 twin_high_res = GetTwinTiling(high_res); 803 twin_high_res = GetTwinTiling(high_res);
798 } 804 }
805
799 // If this layer and its twin have different transforms, then don't compare 806 // If this layer and its twin have different transforms, then don't compare
800 // them and only allow activating to high res tiles, since tiles on each layer 807 // them and only allow activating to high res tiles, since tiles on each layer
801 // will be in different places on screen. 808 // will be in different places on screen.
802 if (!twin_high_res || !twin_low_res || 809 if (!twin_high_res || (!twin_low_res && should_have_low_res) ||
803 twin_layer_->layer_tree_impl()->RequiresHighResToDraw() || 810 twin_layer_->layer_tree_impl()->RequiresHighResToDraw() ||
804 draw_properties().screen_space_transform != 811 draw_properties().screen_space_transform !=
805 twin_layer_->draw_properties().screen_space_transform) { 812 twin_layer_->draw_properties().screen_space_transform) {
806 twin_high_res = NULL; 813 twin_high_res = NULL;
807 twin_low_res = NULL; 814 twin_low_res = NULL;
808 } 815 }
809 816
810 // As a second pass, mark as required any visible high res tiles not filled in 817 // As a second pass, mark as required any visible high res tiles not filled in
811 // by acceptable non-ideal tiles from the first pass. 818 // by acceptable non-ideal tiles from the first pass.
812 if (MarkVisibleTilesAsRequired( 819 if (MarkVisibleTilesAsRequired(
813 high_res, twin_high_res, contents_scale_x(), rect, missing_region)) { 820 high_res, twin_high_res, contents_scale_x(), rect, missing_region)) {
814 // As an optional third pass, if a high res tile was skipped because its 821 // As an optional third pass, if a high res tile was skipped because its
815 // twin was also missing, then fall back to mark low res tiles as required 822 // twin was also missing, then fall back to mark low res tiles as required
816 // in case the active twin is substituting those for missing high res 823 // in case the active twin is substituting those for missing high res
817 // content. 824 // content. Only suitable, when low res is enabled.
818 MarkVisibleTilesAsRequired( 825 if (should_have_low_res) {
819 low_res, twin_low_res, contents_scale_x(), rect, missing_region); 826 MarkVisibleTilesAsRequired(
827 low_res, twin_low_res, contents_scale_x(), rect, missing_region);
828 }
820 } 829 }
821 } 830 }
822 831
823 bool PictureLayerImpl::MarkVisibleTilesAsRequired( 832 bool PictureLayerImpl::MarkVisibleTilesAsRequired(
824 PictureLayerTiling* tiling, 833 PictureLayerTiling* tiling,
825 const PictureLayerTiling* optional_twin_tiling, 834 const PictureLayerTiling* optional_twin_tiling,
826 float contents_scale, 835 float contents_scale,
827 const gfx::Rect& rect, 836 const gfx::Rect& rect,
828 const Region& missing_region) const { 837 const Region& missing_region) const {
829 bool twin_had_missing_tile = false; 838 bool twin_had_missing_tile = false;
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 return iterator_index_ < iterators_.size(); 1517 return iterator_index_ < iterators_.size();
1509 } 1518 }
1510 1519
1511 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1520 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1512 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1521 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1513 return it->get_type() == iteration_stage_ && 1522 return it->get_type() == iteration_stage_ &&
1514 (**it)->required_for_activation() == required_for_activation_; 1523 (**it)->required_for_activation() == required_for_activation_;
1515 } 1524 }
1516 1525
1517 } // namespace cc 1526 } // 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