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

Side by Side Diff: cc/resources/tile_manager.cc

Issue 285373003: Reland "cc: Remove layers that are not drawn from tile manager." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« cc/layers/picture_layer_impl.cc ('K') | « cc/resources/tile_manager.h ('k') | no next file » | 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/resources/tile_manager.h" 5 #include "cc/resources/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 !mts.tile_versions[mts.raster_mode].raster_task_) { 671 !mts.tile_versions[mts.raster_mode].raster_task_) {
672 FreeResourcesForTile(tile); 672 FreeResourcesForTile(tile);
673 continue; 673 continue;
674 } 674 }
675 675
676 // Insert the tile into a priority set. 676 // Insert the tile into a priority set.
677 tiles->InsertTile(tile, mts.bin); 677 tiles->InsertTile(tile, mts.bin);
678 } 678 }
679 } 679 }
680 680
681 void TileManager::CleanUpLayers() {
682 for (size_t i = 0; i < layers_.size(); ++i) {
683 if (layers_[i]->IsDrawnRenderSurfaceLayerListMember())
684 continue;
685
686 layers_[i]->DidUnregisterLayer();
687 std::swap(layers_[i], layers_.back());
688 layers_.pop_back();
689 --i;
690 prioritized_tiles_dirty_ = true;
691 }
692 }
693
681 void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { 694 void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) {
682 TRACE_EVENT0("cc", "TileManager::ManageTiles"); 695 TRACE_EVENT0("cc", "TileManager::ManageTiles");
683 696
684 // Update internal state. 697 // Update internal state.
685 if (state != global_state_) { 698 if (state != global_state_) {
686 global_state_ = state; 699 global_state_ = state;
687 prioritized_tiles_dirty_ = true; 700 prioritized_tiles_dirty_ = true;
688 } 701 }
689 702
703 CleanUpLayers();
704
690 // We need to call CheckForCompletedTasks() once in-between each call 705 // We need to call CheckForCompletedTasks() once in-between each call
691 // to ScheduleTasks() to prevent canceled tasks from being scheduled. 706 // to ScheduleTasks() to prevent canceled tasks from being scheduled.
692 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { 707 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) {
693 rasterizer_delegate_->CheckForCompletedTasks(); 708 rasterizer_delegate_->CheckForCompletedTasks();
694 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; 709 did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
695 } 710 }
696 711
697 UpdatePrioritizedTileSetIfNeeded(); 712 UpdatePrioritizedTileSetIfNeeded();
698 713
699 TileVector tiles_that_need_to_be_rasterized; 714 TileVector tiles_that_need_to_be_rasterized;
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 1625
1611 if (b_priority.resolution != a_priority.resolution) { 1626 if (b_priority.resolution != a_priority.resolution) {
1612 return (prioritize_low_res && b_priority.resolution == LOW_RESOLUTION) || 1627 return (prioritize_low_res && b_priority.resolution == LOW_RESOLUTION) ||
1613 (!prioritize_low_res && b_priority.resolution == HIGH_RESOLUTION) || 1628 (!prioritize_low_res && b_priority.resolution == HIGH_RESOLUTION) ||
1614 (a_priority.resolution == NON_IDEAL_RESOLUTION); 1629 (a_priority.resolution == NON_IDEAL_RESOLUTION);
1615 } 1630 }
1616 return a_priority.IsHigherPriorityThan(b_priority); 1631 return a_priority.IsHigherPriorityThan(b_priority);
1617 } 1632 }
1618 1633
1619 } // namespace cc 1634 } // namespace cc
OLDNEW
« cc/layers/picture_layer_impl.cc ('K') | « cc/resources/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698