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

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

Issue 1131633003: cc: Use multiple PrepareTiles approaches Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/layers/append_quads_data.h ('k') | 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 <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // Keep track of the tilings that were used so that tilings that are 252 // Keep track of the tilings that were used so that tilings that are
253 // unused can be considered for removal. 253 // unused can be considered for removal.
254 last_append_quads_tilings_.clear(); 254 last_append_quads_tilings_.clear();
255 255
256 // Ignore missing tiles outside of viewport for tile priority. This is 256 // Ignore missing tiles outside of viewport for tile priority. This is
257 // normally the same as draw viewport but can be independently overridden by 257 // normally the same as draw viewport but can be independently overridden by
258 // embedders like Android WebView with SetExternalDrawConstraints. 258 // embedders like Android WebView with SetExternalDrawConstraints.
259 gfx::Rect scaled_viewport_for_tile_priority = gfx::ScaleToEnclosingRect( 259 gfx::Rect scaled_viewport_for_tile_priority = gfx::ScaleToEnclosingRect(
260 viewport_rect_for_tile_priority_in_content_space_, max_contents_scale); 260 viewport_rect_for_tile_priority_in_content_space_, max_contents_scale);
261 261
262 // Determine if num_incomplete_tiles and num_missing_tiles can become 0
263 // if we wait long enough.
264 auto ideal_tiling = tilings_->FindTilingWithScale(ideal_contents_scale_);
265 bool ideal_tiling_visible_tiles_can_be_rasterized =
266 ideal_tiling && ideal_tiling->RasterSourceCoversCurrentVisibleTiles();
267 auto raster_tiling = tilings_->FindTilingWithScale(raster_contents_scale_);
268 bool raster_tiling_visible_tiles_can_be_rasterized =
269 raster_tiling && raster_tiling->RasterSourceCoversCurrentVisibleTiles();
270 append_quads_data->raster_source_covers_visible_high_res_tiles =
271 ideal_tiling_visible_tiles_can_be_rasterized ||
272 raster_tiling_visible_tiles_can_be_rasterized;
273
262 size_t missing_tile_count = 0u; 274 size_t missing_tile_count = 0u;
263 size_t on_demand_missing_tile_count = 0u;
264 only_used_low_res_last_append_quads_ = true; 275 only_used_low_res_last_append_quads_ = true;
265 for (PictureLayerTilingSet::CoverageIterator iter( 276 for (PictureLayerTilingSet::CoverageIterator iter(
266 tilings_.get(), max_contents_scale, 277 tilings_.get(), max_contents_scale,
267 shared_quad_state->visible_content_rect, ideal_contents_scale_); 278 shared_quad_state->visible_content_rect, ideal_contents_scale_);
268 iter; ++iter) { 279 iter; ++iter) {
269 gfx::Rect geometry_rect = iter.geometry_rect(); 280 gfx::Rect geometry_rect = iter.geometry_rect();
270 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); 281 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect();
271 gfx::Rect visible_geometry_rect = 282 gfx::Rect visible_geometry_rect =
272 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); 283 scaled_occlusion.GetUnoccludedContentRect(geometry_rect);
273 if (visible_geometry_rect.IsEmpty()) 284 if (visible_geometry_rect.IsEmpty())
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (iter.resolution() != LOW_RESOLUTION) 370 if (iter.resolution() != LOW_RESOLUTION)
360 only_used_low_res_last_append_quads_ = false; 371 only_used_low_res_last_append_quads_ = false;
361 372
362 if (last_append_quads_tilings_.empty() || 373 if (last_append_quads_tilings_.empty() ||
363 last_append_quads_tilings_.back() != iter.CurrentTiling()) { 374 last_append_quads_tilings_.back() != iter.CurrentTiling()) {
364 last_append_quads_tilings_.push_back(iter.CurrentTiling()); 375 last_append_quads_tilings_.push_back(iter.CurrentTiling());
365 } 376 }
366 } 377 }
367 378
368 if (missing_tile_count) { 379 if (missing_tile_count) {
369 TRACE_EVENT_INSTANT2("cc", 380 TRACE_EVENT_INSTANT1("cc", "PictureLayerImpl::AppendQuads checkerboard",
370 "PictureLayerImpl::AppendQuads checkerboard", 381 TRACE_EVENT_SCOPE_THREAD, "missing_tile_count",
371 TRACE_EVENT_SCOPE_THREAD, 382 missing_tile_count);
372 "missing_tile_count",
373 missing_tile_count,
374 "on_demand_missing_tile_count",
375 on_demand_missing_tile_count);
376 } 383 }
377 384
378 // Aggressively remove any tilings that are not seen to save memory. Note 385 // Aggressively remove any tilings that are not seen to save memory. Note
379 // that this is at the expense of doing cause more frequent re-painting. A 386 // that this is at the expense of doing cause more frequent re-painting. A
380 // better scheme would be to maintain a tighter visible_content_rect for the 387 // better scheme would be to maintain a tighter visible_content_rect for the
381 // finer tilings. 388 // finer tilings.
382 CleanUpTilingsOnActiveLayer(last_append_quads_tilings_); 389 CleanUpTilingsOnActiveLayer(last_append_quads_tilings_);
383 } 390 }
384 391
385 bool PictureLayerImpl::UpdateTiles(bool resourceless_software_draw) { 392 bool PictureLayerImpl::UpdateTiles(bool resourceless_software_draw) {
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 1235
1229 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1236 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1230 return !layer_tree_impl()->IsRecycleTree(); 1237 return !layer_tree_impl()->IsRecycleTree();
1231 } 1238 }
1232 1239
1233 bool PictureLayerImpl::HasValidTilePriorities() const { 1240 bool PictureLayerImpl::HasValidTilePriorities() const {
1234 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); 1241 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember();
1235 } 1242 }
1236 1243
1237 } // namespace cc 1244 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/append_quads_data.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698