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

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

Issue 394113002: Tiling priorities in Android Webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better fix Created 6 years, 4 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/picture_layer_impl.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 <limits> 8 #include <limits>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // TODO(danakj): We should always get an occlusion tracker when we are using 405 // TODO(danakj): We should always get an occlusion tracker when we are using
406 // occlusion, so update this check when we don't use a pending tree in the 406 // occlusion, so update this check when we don't use a pending tree in the
407 // browser compositor. 407 // browser compositor.
408 DCHECK(!occlusion_tracker || 408 DCHECK(!occlusion_tracker ||
409 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization); 409 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization);
410 410
411 // Transforms and viewport are invalid for tile management inside a 411 // Transforms and viewport are invalid for tile management inside a
412 // resourceless software draw, so don't update them. 412 // resourceless software draw, so don't update them.
413 if (!layer_tree_impl()->resourceless_software_draw()) { 413 if (!layer_tree_impl()->resourceless_software_draw()) {
414 visible_rect_for_tile_priority_ = visible_content_rect(); 414 visible_rect_for_tile_priority_ = visible_content_rect();
415 viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); 415 viewport_rect_for_tile_priority_ =
416 layer_tree_impl()->ViewportRectForTilePriority();
416 screen_space_transform_for_tile_priority_ = screen_space_transform(); 417 screen_space_transform_for_tile_priority_ = screen_space_transform();
417 } 418 }
418 419
419 if (!CanHaveTilings()) { 420 if (!CanHaveTilings()) {
420 ideal_page_scale_ = 0.f; 421 ideal_page_scale_ = 0.f;
421 ideal_device_scale_ = 0.f; 422 ideal_device_scale_ = 0.f;
422 ideal_contents_scale_ = 0.f; 423 ideal_contents_scale_ = 0.f;
423 ideal_source_scale_ = 0.f; 424 ideal_source_scale_ = 0.f;
424 SanityCheckTilingState(); 425 SanityCheckTilingState();
425 return; 426 return;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 464 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
464 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( 465 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime(
465 current_frame_time_in_seconds)) { 466 current_frame_time_in_seconds)) {
466 tiling_needs_update = true; 467 tiling_needs_update = true;
467 break; 468 break;
468 } 469 }
469 } 470 }
470 if (!tiling_needs_update) 471 if (!tiling_needs_update)
471 return; 472 return;
472 473
473 // Use visible_content_rect, unless it's empty. If it's empty, then 474 // If visible_rect_for_tile_priority_ is empty or
474 // try to inverse project the viewport into layer space and use that. 475 // viewport_rect_for_tile_priority_ is set to be different from the device
476 // viewport, try to inverse project the viewport into layer space and use
477 // that. Otherwise just use visible_rect_for_tile_priority_
475 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; 478 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_;
476 if (visible_rect_in_content_space.IsEmpty()) { 479
477 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); 480 if (visible_rect_in_content_space.IsEmpty() ||
478 if (screen_space_transform_for_tile_priority_.GetInverse( 481 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority_) {
479 &screen_to_layer)) { 482 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization);
483
484 if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer)) {
485 // Transform from view space to content space.
480 visible_rect_in_content_space = 486 visible_rect_in_content_space =
481 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( 487 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect(
482 screen_to_layer, gfx::Rect(viewport_size_for_tile_priority_))); 488 view_to_layer, viewport_rect_for_tile_priority_));
489
483 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); 490 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds()));
484 } 491 }
485 } 492 }
486 493
487 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( 494 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect(
488 visible_rect_in_content_space, 1.f / contents_scale_x()); 495 visible_rect_in_content_space, 1.f / contents_scale_x());
489 WhichTree tree = 496 WhichTree tree =
490 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; 497 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
491 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 498 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
492 tilings_->tiling_at(i)->UpdateTilePriorities(tree, 499 tilings_->tiling_at(i)->UpdateTilePriorities(tree,
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 return iterator_index_ < iterators_.size(); 1673 return iterator_index_ < iterators_.size();
1667 } 1674 }
1668 1675
1669 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1676 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1670 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1677 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1671 return it->get_type() == iteration_stage_ && 1678 return it->get_type() == iteration_stage_ &&
1672 (**it)->required_for_activation() == required_for_activation_; 1679 (**it)->required_for_activation() == required_for_activation_;
1673 } 1680 }
1674 1681
1675 } // namespace cc 1682 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698