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

Side by Side Diff: cc/test/fake_picture_layer_impl.cc

Issue 672283003: cc: ReadyToDraw notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix counting of required for activation tiles. Created 6 years, 1 month 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/test/fake_picture_layer_impl.h ('k') | cc/test/fake_tile_manager_client.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test/fake_picture_layer_impl.h" 5 #include "cc/test/fake_picture_layer_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 #include "cc/resources/tile.h" 8 #include "cc/resources/tile.h"
9 #include "cc/trees/layer_tree_impl.h" 9 #include "cc/trees/layer_tree_impl.h"
10 10
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 PictureLayerImpl::DidBecomeActive(); 186 PictureLayerImpl::DidBecomeActive();
187 ++did_become_active_call_count_; 187 ++did_become_active_call_count_;
188 } 188 }
189 189
190 bool FakePictureLayerImpl::HasValidTilePriorities() const { 190 bool FakePictureLayerImpl::HasValidTilePriorities() const {
191 return use_set_valid_tile_priorities_flag_ 191 return use_set_valid_tile_priorities_flag_
192 ? has_valid_tile_priorities_ 192 ? has_valid_tile_priorities_
193 : PictureLayerImpl::HasValidTilePriorities(); 193 : PictureLayerImpl::HasValidTilePriorities();
194 } 194 }
195 195
196 size_t FakePictureLayerImpl::CountTilesRequired(
197 TileRequirementCheck is_tile_required_callback) const {
198 if (!HasValidTilePriorities())
199 return 0;
200
201 if (!tilings_)
202 return 0;
203
204 if (visible_rect_for_tile_priority_.IsEmpty())
205 return 0;
206
207 gfx::Rect rect = GetViewportForTilePriorityInContentSpace();
208 rect.Intersect(visible_rect_for_tile_priority_);
209
210 size_t count = 0;
211
212 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
213 PictureLayerTiling* tiling = tilings_->tiling_at(i);
214 if (tiling->resolution() != HIGH_RESOLUTION &&
215 tiling->resolution() != LOW_RESOLUTION)
216 continue;
217
218 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter;
219 ++iter) {
220 const Tile* tile = *iter;
221 // A null tile (i.e. missing recording) can just be skipped.
222 // TODO(vmpstr): Verify this is true if we create tiles in raster
223 // iterators.
224 if (!tile)
225 continue;
226
227 // We can't check tile->required_for_activation, because that value might
228 // be out of date. It is updated in the raster/eviction iterators.
229 // TODO(vmpstr): Remove the comment once you can't access this information
230 // from the tile.
231 if ((tiling->*is_tile_required_callback)(tile))
232 ++count;
233 }
234 }
235
236 return count;
237 }
238
239 size_t FakePictureLayerImpl::CountTilesRequiredForActivation() const {
240 if (!layer_tree_impl()->IsPendingTree())
241 return 0;
242
243 return CountTilesRequired(
244 &PictureLayerTiling::IsTileRequiredForActivationIfVisible);
245 }
246
247 size_t FakePictureLayerImpl::CountTilesRequiredForDraw() const {
248 if (!layer_tree_impl()->IsActiveTree())
249 return 0;
250
251 return CountTilesRequired(
252 &PictureLayerTiling::IsTileRequiredForDrawIfVisible);
253 }
254
196 void FakePictureLayerImpl::ReleaseResources() { 255 void FakePictureLayerImpl::ReleaseResources() {
197 PictureLayerImpl::ReleaseResources(); 256 PictureLayerImpl::ReleaseResources();
198 ++release_resources_count_; 257 ++release_resources_count_;
199 } 258 }
200 259
201 } // namespace cc 260 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_picture_layer_impl.h ('k') | cc/test/fake_tile_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698