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

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: Address comments Created 6 years, 5 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // TODO(danakj): We should always get an occlusion tracker when we are using 392 // TODO(danakj): We should always get an occlusion tracker when we are using
393 // occlusion, so update this check when we don't use a pending tree in the 393 // occlusion, so update this check when we don't use a pending tree in the
394 // browser compositor. 394 // browser compositor.
395 DCHECK(!occlusion_tracker || 395 DCHECK(!occlusion_tracker ||
396 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization); 396 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization);
397 397
398 // Transforms and viewport are invalid for tile management inside a 398 // Transforms and viewport are invalid for tile management inside a
399 // resourceless software draw, so don't update them. 399 // resourceless software draw, so don't update them.
400 if (!layer_tree_impl()->resourceless_software_draw()) { 400 if (!layer_tree_impl()->resourceless_software_draw()) {
401 visible_rect_for_tile_priority_ = visible_content_rect(); 401 visible_rect_for_tile_priority_ = visible_content_rect();
402 viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); 402 viewport_rect_for_tile_priority_ = layer_tree_impl()->ExternalTilingRect();
403 screen_space_transform_for_tile_priority_ = screen_space_transform(); 403 screen_space_transform_for_tile_priority_ = screen_space_transform();
404 } 404 }
405 405
406 if (!CanHaveTilings()) { 406 if (!CanHaveTilings()) {
407 ideal_page_scale_ = 0.f; 407 ideal_page_scale_ = 0.f;
408 ideal_device_scale_ = 0.f; 408 ideal_device_scale_ = 0.f;
409 ideal_contents_scale_ = 0.f; 409 ideal_contents_scale_ = 0.f;
410 ideal_source_scale_ = 0.f; 410 ideal_source_scale_ = 0.f;
411 SanityCheckTilingState(); 411 SanityCheckTilingState();
412 return; 412 return;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 450 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
451 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( 451 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime(
452 current_frame_time_in_seconds)) { 452 current_frame_time_in_seconds)) {
453 tiling_needs_update = true; 453 tiling_needs_update = true;
454 break; 454 break;
455 } 455 }
456 } 456 }
457 if (!tiling_needs_update) 457 if (!tiling_needs_update)
458 return; 458 return;
459 459
460 // Use visible_content_rect, unless it's empty. If it's empty, then 460 // If visible_rect_for_tile_priority_ is empty or
461 // try to inverse project the viewport into layer space and use that. 461 // LayerTreeImpl::ExternalTilingRect is set to be different from the device
462 // viewport, try to inverse project the viewport into layer space and use
463 // that. Otherwise just use visible_rect_for_tile_priority_
462 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; 464 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_;
463 if (visible_rect_in_content_space.IsEmpty()) { 465 gfx::Rect external_tiling_rect = layer_tree_impl()->ExternalTilingRect();
466 gfx::Transform external_tiling_transform =
467 layer_tree_impl()->ExternalTilingTransform();
468 gfx::Transform identity;
469 gfx::Transform layer_to_screen = screen_space_transform_for_tile_priority_;
470 layer_to_screen.ConcatTransform(external_tiling_transform);
aelias_OOO_until_Jul13 2014/07/16 21:23:31 Please bake it into screen_space_transform_for_til
hush (inactive) 2014/07/17 00:05:53 Done.
471 if (visible_rect_in_content_space.IsEmpty() ||
472 layer_tree_impl()->DrawViewportSize() != external_tiling_rect.size() ||
aelias_OOO_until_Jul13 2014/07/16 21:23:31 Please cast the DrawViewportSize to a rect instead
hush (inactive) 2014/07/17 00:05:53 Yes, indeed it is missing that case. I will use De
473 !external_tiling_transform.IsIdentity()) {
464 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); 474 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization);
465 if (screen_space_transform_for_tile_priority_.GetInverse( 475
466 &screen_to_layer)) { 476 if (layer_to_screen.GetInverse(&screen_to_layer)) {
467 visible_rect_in_content_space = 477 // Transform from view space to content space.
468 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( 478 visible_rect_in_content_space = gfx::ToEnclosingRect(
469 screen_to_layer, gfx::Rect(viewport_size_for_tile_priority_))); 479 MathUtil::ProjectClippedRect(screen_to_layer, external_tiling_rect));
480
470 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); 481 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds()));
471 } 482 }
472 } 483 }
473 484
474 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( 485 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect(
475 visible_rect_in_content_space, 1.f / contents_scale_x()); 486 visible_rect_in_content_space, 1.f / contents_scale_x());
476 WhichTree tree = 487 WhichTree tree =
477 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; 488 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
478 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 489 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
479 tilings_->tiling_at(i)->UpdateTilePriorities(tree, 490 tilings_->tiling_at(i)->UpdateTilePriorities(tree,
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 return iterator_index_ < iterators_.size(); 1646 return iterator_index_ < iterators_.size();
1636 } 1647 }
1637 1648
1638 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1649 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1639 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1650 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1640 return it->get_type() == iteration_stage_ && 1651 return it->get_type() == iteration_stage_ &&
1641 (**it)->required_for_activation() == required_for_activation_; 1652 (**it)->required_for_activation() == required_for_activation_;
1642 } 1653 }
1643 1654
1644 } // namespace cc 1655 } // 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