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

Side by Side Diff: cc/resources/picture_layer_tiling_set.cc

Issue 1051993002: cc: Remove tile sharing from tilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « cc/resources/picture_layer_tiling_set.h ('k') | cc/resources/picture_layer_tiling_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/resources/picture_layer_tiling_set.h" 5 #include "cc/resources/picture_layer_tiling_set.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 skewport_extrapolation_limit_in_content_pixels_( 48 skewport_extrapolation_limit_in_content_pixels_(
49 skewport_extrapolation_limit_in_content_pixels), 49 skewport_extrapolation_limit_in_content_pixels),
50 client_(client) { 50 client_(client) {
51 } 51 }
52 52
53 PictureLayerTilingSet::~PictureLayerTilingSet() { 53 PictureLayerTilingSet::~PictureLayerTilingSet() {
54 } 54 }
55 55
56 void PictureLayerTilingSet::CopyTilingsAndPropertiesFromPendingTwin( 56 void PictureLayerTilingSet::CopyTilingsAndPropertiesFromPendingTwin(
57 const PictureLayerTilingSet* pending_twin_set, 57 const PictureLayerTilingSet* pending_twin_set,
58 const scoped_refptr<RasterSource>& raster_source) { 58 const scoped_refptr<RasterSource>& raster_source,
59 const Region& layer_invalidation) {
59 if (pending_twin_set->tilings_.empty()) { 60 if (pending_twin_set->tilings_.empty()) {
60 // If the twin (pending) tiling set is empty, it was not updated for the 61 // If the twin (pending) tiling set is empty, it was not updated for the
61 // current frame. So we drop tilings from our set as well, instead of 62 // current frame. So we drop tilings from our set as well, instead of
62 // leaving behind unshared tilings that are all non-ideal. 63 // leaving behind unshared tilings that are all non-ideal.
63 RemoveAllTilings(); 64 RemoveAllTilings();
64 return; 65 return;
65 } 66 }
66 67
67 bool tiling_sort_required = false; 68 bool tiling_sort_required = false;
68 for (PictureLayerTiling* pending_twin_tiling : pending_twin_set->tilings_) { 69 for (PictureLayerTiling* pending_twin_tiling : pending_twin_set->tilings_) {
69 float contents_scale = pending_twin_tiling->contents_scale(); 70 float contents_scale = pending_twin_tiling->contents_scale();
70 PictureLayerTiling* this_tiling = FindTilingWithScale(contents_scale); 71 PictureLayerTiling* this_tiling = FindTilingWithScale(contents_scale);
71 if (!this_tiling) { 72 if (!this_tiling) {
72 scoped_ptr<PictureLayerTiling> new_tiling = PictureLayerTiling::Create( 73 scoped_ptr<PictureLayerTiling> new_tiling = PictureLayerTiling::Create(
73 contents_scale, raster_source, client_, max_tiles_for_interest_area_, 74 contents_scale, raster_source, client_, max_tiles_for_interest_area_,
74 skewport_target_time_in_seconds_, 75 skewport_target_time_in_seconds_,
75 skewport_extrapolation_limit_in_content_pixels_); 76 skewport_extrapolation_limit_in_content_pixels_);
76 tilings_.push_back(new_tiling.Pass()); 77 tilings_.push_back(new_tiling.Pass());
77 this_tiling = tilings_.back(); 78 this_tiling = tilings_.back();
78 tiling_sort_required = true; 79 tiling_sort_required = true;
79 } 80 }
80 this_tiling->CloneTilesAndPropertiesFrom(*pending_twin_tiling); 81 this_tiling->TakeTilesAndPropertiesFrom(pending_twin_tiling,
82 layer_invalidation);
81 } 83 }
82 84
83 if (tiling_sort_required) 85 if (tiling_sort_required)
84 tilings_.sort(LargestToSmallestScaleFunctor()); 86 tilings_.sort(LargestToSmallestScaleFunctor());
85 } 87 }
86 88
87 void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForActivation( 89 void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForActivation(
88 scoped_refptr<RasterSource> raster_source, 90 scoped_refptr<RasterSource> raster_source,
89 const PictureLayerTilingSet* pending_twin_set, 91 const PictureLayerTilingSet* pending_twin_set,
90 const Region& layer_invalidation, 92 const Region& layer_invalidation,
91 float minimum_contents_scale, 93 float minimum_contents_scale,
92 float maximum_contents_scale) { 94 float maximum_contents_scale) {
93 RemoveTilingsBelowScale(minimum_contents_scale); 95 RemoveTilingsBelowScale(minimum_contents_scale);
94 RemoveTilingsAboveScale(maximum_contents_scale); 96 RemoveTilingsAboveScale(maximum_contents_scale);
95 97
96 // Copy over tilings that are shared with the |pending_twin_set| tiling set. 98 // Copy over tilings that are shared with the |pending_twin_set| tiling set.
97 // Also, copy all of the properties from twin tilings. 99 // Also, copy all of the properties from twin tilings.
98 CopyTilingsAndPropertiesFromPendingTwin(pending_twin_set, raster_source); 100 CopyTilingsAndPropertiesFromPendingTwin(pending_twin_set, raster_source,
101 layer_invalidation);
99 102
100 // If the tiling is not shared (FindTilingWithScale returns nullptr), then 103 // If the tiling is not shared (FindTilingWithScale returns nullptr), then
101 // invalidate tiles and update them to the new raster source. 104 // invalidate tiles and update them to the new raster source.
102 for (PictureLayerTiling* tiling : tilings_) { 105 for (PictureLayerTiling* tiling : tilings_) {
103 if (pending_twin_set->FindTilingWithScale(tiling->contents_scale())) 106 if (pending_twin_set->FindTilingWithScale(tiling->contents_scale()))
104 continue; 107 continue;
105 108
106 tiling->SetRasterSourceAndResize(raster_source); 109 tiling->SetRasterSourceAndResize(raster_source);
107 tiling->Invalidate(layer_invalidation); 110 tiling->Invalidate(layer_invalidation);
108 tiling->SetRasterSourceOnTiles(); 111 tiling->SetRasterSourceOnTiles();
(...skipping 30 matching lines...) Expand all
139 } 142 }
140 VerifyTilings(nullptr /* pending_twin_set */); 143 VerifyTilings(nullptr /* pending_twin_set */);
141 } 144 }
142 145
143 void PictureLayerTilingSet::UpdateRasterSourceDueToLCDChange( 146 void PictureLayerTilingSet::UpdateRasterSourceDueToLCDChange(
144 const scoped_refptr<RasterSource>& raster_source, 147 const scoped_refptr<RasterSource>& raster_source,
145 const Region& layer_invalidation) { 148 const Region& layer_invalidation) {
146 for (PictureLayerTiling* tiling : tilings_) { 149 for (PictureLayerTiling* tiling : tilings_) {
147 tiling->SetRasterSourceAndResize(raster_source); 150 tiling->SetRasterSourceAndResize(raster_source);
148 tiling->Invalidate(layer_invalidation); 151 tiling->Invalidate(layer_invalidation);
152 // Since the invalidation changed, we need to create any missing tiles in
153 // the live tiles rect again.
154 tiling->CreateMissingTilesInLiveTilesRect();
149 tiling->VerifyAllTilesHaveCurrentRasterSource(); 155 tiling->VerifyAllTilesHaveCurrentRasterSource();
150 } 156 }
151 } 157 }
152 158
153 void PictureLayerTilingSet::VerifyTilings( 159 void PictureLayerTilingSet::VerifyTilings(
154 const PictureLayerTilingSet* pending_twin_set) const { 160 const PictureLayerTilingSet* pending_twin_set) const {
155 #if DCHECK_IS_ON() 161 #if DCHECK_IS_ON()
156 for (PictureLayerTiling* tiling : tilings_) { 162 for (PictureLayerTiling* tiling : tilings_) {
157 DCHECK(tiling->tile_size() == 163 DCHECK(tiling->tile_size() ==
158 client_->CalculateTileSize(tiling->tiling_size())) 164 client_->CalculateTileSize(tiling->tiling_size()))
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 case LOWER_THAN_LOW_RES: 590 case LOWER_THAN_LOW_RES:
585 range = TilingRange(low_res_range.end, tilings_.size()); 591 range = TilingRange(low_res_range.end, tilings_.size());
586 break; 592 break;
587 } 593 }
588 594
589 DCHECK_LE(range.start, range.end); 595 DCHECK_LE(range.start, range.end);
590 return range; 596 return range;
591 } 597 }
592 598
593 } // namespace cc 599 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_set.h ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698