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

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

Issue 268683002: Revert of cc: Change required_for_activation bookkeeping. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebaselined Created 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/resources/tile_manager.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 raster_device_scale_(0.f), 49 raster_device_scale_(0.f),
50 raster_source_scale_(0.f), 50 raster_source_scale_(0.f),
51 raster_contents_scale_(0.f), 51 raster_contents_scale_(0.f),
52 low_res_raster_contents_scale_(0.f), 52 low_res_raster_contents_scale_(0.f),
53 raster_source_scale_was_animating_(false), 53 raster_source_scale_was_animating_(false),
54 is_using_lcd_text_(tree_impl->settings().can_use_lcd_text), 54 is_using_lcd_text_(tree_impl->settings().can_use_lcd_text),
55 needs_post_commit_initialization_(true), 55 needs_post_commit_initialization_(true),
56 should_update_tile_priorities_(false), 56 should_update_tile_priorities_(false),
57 should_use_low_res_tiling_(tree_impl->settings().create_low_res_tiling), 57 should_use_low_res_tiling_(tree_impl->settings().create_low_res_tiling),
58 use_gpu_rasterization_(false), 58 use_gpu_rasterization_(false),
59 layer_needs_to_register_itself_(true), 59 layer_needs_to_register_itself_(true) {}
60 uninitialized_tiles_required_for_activation_count_(0) {
61 }
62 60
63 PictureLayerImpl::~PictureLayerImpl() { 61 PictureLayerImpl::~PictureLayerImpl() {
64 if (!layer_needs_to_register_itself_) 62 if (!layer_needs_to_register_itself_)
65 layer_tree_impl()->tile_manager()->UnregisterPictureLayerImpl(this); 63 layer_tree_impl()->tile_manager()->UnregisterPictureLayerImpl(this);
66 } 64 }
67 65
68 const char* PictureLayerImpl::LayerTypeAsString() const { 66 const char* PictureLayerImpl::LayerTypeAsString() const {
69 return "cc::PictureLayerImpl"; 67 return "cc::PictureLayerImpl";
70 } 68 }
71 69
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 398 }
401 399
402 WhichTree tree = 400 WhichTree tree =
403 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; 401 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
404 402
405 tilings_->UpdateTilePriorities(tree, 403 tilings_->UpdateTilePriorities(tree,
406 visible_rect_in_content_space, 404 visible_rect_in_content_space,
407 contents_scale_x(), 405 contents_scale_x(),
408 current_frame_time_in_seconds); 406 current_frame_time_in_seconds);
409 407
410 uninitialized_tiles_required_for_activation_count_ = 0;
411 if (layer_tree_impl()->IsPendingTree()) 408 if (layer_tree_impl()->IsPendingTree())
412 MarkVisibleResourcesAsRequired(); 409 MarkVisibleResourcesAsRequired();
413 410
414 // Tile priorities were modified. 411 // Tile priorities were modified.
415 layer_tree_impl()->DidModifyTilePriorities(); 412 layer_tree_impl()->DidModifyTilePriorities();
416 } 413 }
417 414
418 void PictureLayerImpl::NotifyTileInitialized(const Tile* tile) { 415 void PictureLayerImpl::NotifyTileInitialized(const Tile* tile) {
419 if (layer_tree_impl()->IsActiveTree()) { 416 if (layer_tree_impl()->IsActiveTree()) {
420 gfx::RectF layer_damage_rect = 417 gfx::RectF layer_damage_rect =
421 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); 418 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale());
422 AddDamageRect(layer_damage_rect); 419 AddDamageRect(layer_damage_rect);
423
424 DCHECK_EQ(0, uninitialized_tiles_required_for_activation_count_);
425 } else if (layer_tree_impl()->IsPendingTree()) {
426 if (tile->required_for_activation()) {
427 DCHECK_GT(uninitialized_tiles_required_for_activation_count_, 0);
428 --uninitialized_tiles_required_for_activation_count_;
429 }
430 } 420 }
431 } 421 }
432 422
433 void PictureLayerImpl::DidBecomeActive() { 423 void PictureLayerImpl::DidBecomeActive() {
434 LayerImpl::DidBecomeActive(); 424 LayerImpl::DidBecomeActive();
435 tilings_->DidBecomeActive(); 425 tilings_->DidBecomeActive();
436 layer_tree_impl()->DidModifyTilePriorities(); 426 layer_tree_impl()->DidModifyTilePriorities();
437 } 427 }
438 428
439 void PictureLayerImpl::DidBeginTracing() { 429 void PictureLayerImpl::DidBeginTracing() {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 728
739 const ManagedTileState::TileVersion& tile_version = 729 const ManagedTileState::TileVersion& tile_version =
740 iter->GetTileVersionForDrawing(); 730 iter->GetTileVersionForDrawing();
741 if (!tile_version.IsReadyToDraw() || 731 if (!tile_version.IsReadyToDraw() ||
742 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE) 732 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE)
743 return 0; 733 return 0;
744 734
745 return tile_version.get_resource_id(); 735 return tile_version.get_resource_id();
746 } 736 }
747 737
748 void PictureLayerImpl::MarkVisibleResourcesAsRequired() { 738 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const {
749 DCHECK(layer_tree_impl()->IsPendingTree()); 739 DCHECK(layer_tree_impl()->IsPendingTree());
750 DCHECK(!layer_tree_impl()->needs_update_draw_properties()); 740 DCHECK(!layer_tree_impl()->needs_update_draw_properties());
751 DCHECK(ideal_contents_scale_); 741 DCHECK(ideal_contents_scale_);
752 DCHECK_GT(tilings_->num_tilings(), 0u); 742 DCHECK_GT(tilings_->num_tilings(), 0u);
753 743
754 // The goal of this function is to find the minimum set of tiles that need to 744 // The goal of this function is to find the minimum set of tiles that need to
755 // be ready to draw in order to activate without flashing content from a 745 // be ready to draw in order to activate without flashing content from a
756 // higher res on the active tree to a lower res on the pending tree. 746 // higher res on the active tree to a lower res on the pending tree.
757 747
758 gfx::Rect rect(visible_content_rect()); 748 gfx::Rect rect(visible_content_rect());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 MarkVisibleTilesAsRequired( 836 MarkVisibleTilesAsRequired(
847 low_res, twin_low_res, contents_scale_x(), rect, missing_region); 837 low_res, twin_low_res, contents_scale_x(), rect, missing_region);
848 } 838 }
849 } 839 }
850 840
851 bool PictureLayerImpl::MarkVisibleTilesAsRequired( 841 bool PictureLayerImpl::MarkVisibleTilesAsRequired(
852 PictureLayerTiling* tiling, 842 PictureLayerTiling* tiling,
853 const PictureLayerTiling* optional_twin_tiling, 843 const PictureLayerTiling* optional_twin_tiling,
854 float contents_scale, 844 float contents_scale,
855 const gfx::Rect& rect, 845 const gfx::Rect& rect,
856 const Region& missing_region) { 846 const Region& missing_region) const {
857 bool twin_had_missing_tile = false; 847 bool twin_had_missing_tile = false;
858 for (PictureLayerTiling::CoverageIterator iter(tiling, 848 for (PictureLayerTiling::CoverageIterator iter(tiling,
859 contents_scale, 849 contents_scale,
860 rect); 850 rect);
861 iter; 851 iter;
862 ++iter) { 852 ++iter) {
863 Tile* tile = *iter; 853 Tile* tile = *iter;
864 // A null tile (i.e. missing recording) can just be skipped. 854 // A null tile (i.e. missing recording) can just be skipped.
865 if (!tile) 855 if (!tile)
866 continue; 856 continue;
867 857
868 // If the missing region doesn't cover it, this tile is fully 858 // If the missing region doesn't cover it, this tile is fully
869 // covered by acceptable tiles at other scales. 859 // covered by acceptable tiles at other scales.
870 if (!missing_region.Intersects(iter.geometry_rect())) 860 if (!missing_region.Intersects(iter.geometry_rect()))
871 continue; 861 continue;
872 862
873 // If the twin tile doesn't exist (i.e. missing recording or so far away 863 // If the twin tile doesn't exist (i.e. missing recording or so far away
874 // that it is outside the visible tile rect) or this tile is shared between 864 // that it is outside the visible tile rect) or this tile is shared between
875 // with the twin, then this tile isn't required to prevent flashing. 865 // with the twin, then this tile isn't required to prevent flashing.
876 if (optional_twin_tiling) { 866 if (optional_twin_tiling) {
877 Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j()); 867 Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j());
878 if (!twin_tile || twin_tile == tile) { 868 if (!twin_tile || twin_tile == tile) {
879 twin_had_missing_tile = true; 869 twin_had_missing_tile = true;
880 continue; 870 continue;
881 } 871 }
882 } 872 }
883 DCHECK(!tile->required_for_activation()); 873
884 tile->MarkRequiredForActivation(); 874 tile->MarkRequiredForActivation();
885 if (!tile->IsReadyToDraw())
886 ++uninitialized_tiles_required_for_activation_count_;
887 } 875 }
888 return twin_had_missing_tile; 876 return twin_had_missing_tile;
889 } 877 }
890 878
891 void PictureLayerImpl::DoPostCommitInitialization() { 879 void PictureLayerImpl::DoPostCommitInitialization() {
892 DCHECK(needs_post_commit_initialization_); 880 DCHECK(needs_post_commit_initialization_);
893 DCHECK(layer_tree_impl()->IsPendingTree()); 881 DCHECK(layer_tree_impl()->IsPendingTree());
894 882
895 if (!tilings_) 883 if (!tilings_)
896 tilings_.reset(new PictureLayerTilingSet(this, bounds())); 884 tilings_.reset(new PictureLayerTilingSet(this, bounds()));
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 return iterator_index_ < iterators_.size(); 1526 return iterator_index_ < iterators_.size();
1539 } 1527 }
1540 1528
1541 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1529 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1542 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1530 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1543 return it->get_type() == iteration_stage_ && 1531 return it->get_type() == iteration_stage_ &&
1544 (**it)->required_for_activation() == required_for_activation_; 1532 (**it)->required_for_activation() == required_for_activation_;
1545 } 1533 }
1546 1534
1547 } // namespace cc 1535 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/resources/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698