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

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

Issue 377793003: Consider occluded tiles during eviction with occluded as Tile property. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/tile.h ('k') | cc/resources/tile_manager_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/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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 tile_priority = tile->combined_priority(); 589 tile_priority = tile->combined_priority();
590 break; 590 break;
591 case SMOOTHNESS_TAKES_PRIORITY: 591 case SMOOTHNESS_TAKES_PRIORITY:
592 mts.bin = tree_bin[ACTIVE_TREE]; 592 mts.bin = tree_bin[ACTIVE_TREE];
593 tile_priority = active_priority; 593 tile_priority = active_priority;
594 break; 594 break;
595 case NEW_CONTENT_TAKES_PRIORITY: 595 case NEW_CONTENT_TAKES_PRIORITY:
596 mts.bin = tree_bin[PENDING_TREE]; 596 mts.bin = tree_bin[PENDING_TREE];
597 tile_priority = pending_priority; 597 tile_priority = pending_priority;
598 break; 598 break;
599 default:
600 NOTREACHED();
599 } 601 }
600 602
601 // Bump up the priority if we determined it's NEVER_BIN on one tree, 603 // Bump up the priority if we determined it's NEVER_BIN on one tree,
602 // but is still required on the other tree. 604 // but is still required on the other tree.
603 bool is_in_never_bin_on_both_trees = tree_bin[ACTIVE_TREE] == NEVER_BIN && 605 bool is_in_never_bin_on_both_trees = tree_bin[ACTIVE_TREE] == NEVER_BIN &&
604 tree_bin[PENDING_TREE] == NEVER_BIN; 606 tree_bin[PENDING_TREE] == NEVER_BIN;
605 607
606 if (mts.bin == NEVER_BIN && !is_in_never_bin_on_both_trees) 608 if (mts.bin == NEVER_BIN && !is_in_never_bin_on_both_trees)
607 mts.bin = tile_is_active ? AT_LAST_AND_ACTIVE_BIN : AT_LAST_BIN; 609 mts.bin = tile_is_active ? AT_LAST_AND_ACTIVE_BIN : AT_LAST_BIN;
608 610
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 return std::make_pair(&active_iterator, ACTIVE_TREE); 1312 return std::make_pair(&active_iterator, ACTIVE_TREE);
1311 1313
1312 const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE); 1314 const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE);
1313 const TilePriority& pending_priority = 1315 const TilePriority& pending_priority =
1314 pending_tile->priority(PENDING_TREE); 1316 pending_tile->priority(PENDING_TREE);
1315 1317
1316 if (active_priority.IsHigherPriorityThan(pending_priority)) 1318 if (active_priority.IsHigherPriorityThan(pending_priority))
1317 return std::make_pair(&active_iterator, ACTIVE_TREE); 1319 return std::make_pair(&active_iterator, ACTIVE_TREE);
1318 return std::make_pair(&pending_iterator, PENDING_TREE); 1320 return std::make_pair(&pending_iterator, PENDING_TREE);
1319 } 1321 }
1322 default:
1323 NOTREACHED();
1320 } 1324 }
1321 1325
1322 NOTREACHED(); 1326 NOTREACHED();
1323 // Keep the compiler happy. 1327 // Keep the compiler happy.
1324 return std::pair<PictureLayerImpl::LayerRasterTileIterator*, WhichTree>( 1328 return std::pair<PictureLayerImpl::LayerRasterTileIterator*, WhichTree>(
1325 NULL, ACTIVE_TREE); 1329 NULL, ACTIVE_TREE);
1326 } 1330 }
1327 1331
1328 TileManager::RasterTileIterator::RasterOrderComparator::RasterOrderComparator( 1332 TileManager::RasterTileIterator::RasterOrderComparator::RasterOrderComparator(
1329 TreePriority tree_priority) 1333 TreePriority tree_priority)
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 Tile* b_tile = **b_iterator; 1531 Tile* b_tile = **b_iterator;
1528 1532
1529 const TilePriority& a_priority = 1533 const TilePriority& a_priority =
1530 a_tile->priority_for_tree_priority(tree_priority_); 1534 a_tile->priority_for_tree_priority(tree_priority_);
1531 const TilePriority& b_priority = 1535 const TilePriority& b_priority =
1532 b_tile->priority_for_tree_priority(tree_priority_); 1536 b_tile->priority_for_tree_priority(tree_priority_);
1533 bool prioritize_low_res = tree_priority_ == SMOOTHNESS_TAKES_PRIORITY; 1537 bool prioritize_low_res = tree_priority_ == SMOOTHNESS_TAKES_PRIORITY;
1534 1538
1535 // Now we have to return true iff b is lower priority than a. 1539 // Now we have to return true iff b is lower priority than a.
1536 1540
1537 // If the bin is the same but the resolution is not, then the order will be 1541 // If the priority bin differs, b is lower priority if it has the higher
1538 // determined by whether we prioritize low res or not. 1542 // priority bin.
1543 if (a_priority.priority_bin != b_priority.priority_bin)
1544 return b_priority.priority_bin > a_priority.priority_bin;
1545
1546 // Otherwise if the resolution differs, then the order will be determined by
1547 // whether we prioritize low res or not.
1539 // TODO(vmpstr): Remove this when TilePriority is no longer a member of Tile 1548 // TODO(vmpstr): Remove this when TilePriority is no longer a member of Tile
1540 // class but instead produced by the iterators. 1549 // class but instead produced by the iterators.
1541 if (b_priority.priority_bin == a_priority.priority_bin && 1550 if (b_priority.resolution != a_priority.resolution) {
1542 b_priority.resolution != a_priority.resolution) {
1543 // Non ideal resolution should be sorted higher than other resolutions. 1551 // Non ideal resolution should be sorted higher than other resolutions.
1544 if (a_priority.resolution == NON_IDEAL_RESOLUTION) 1552 if (a_priority.resolution == NON_IDEAL_RESOLUTION)
1545 return false; 1553 return false;
1546 1554
1547 if (b_priority.resolution == NON_IDEAL_RESOLUTION) 1555 if (b_priority.resolution == NON_IDEAL_RESOLUTION)
1548 return true; 1556 return true;
1549 1557
1550 if (prioritize_low_res) 1558 if (prioritize_low_res)
1551 return a_priority.resolution == LOW_RESOLUTION; 1559 return a_priority.resolution == LOW_RESOLUTION;
1552 1560
1553 return a_priority.resolution == HIGH_RESOLUTION; 1561 return a_priority.resolution == HIGH_RESOLUTION;
1554 } 1562 }
1555 return a_priority.IsHigherPriorityThan(b_priority); 1563
1564 // Otherwise if the occlusion differs, b is lower priority if it is occluded.
1565 bool a_is_occluded = a_tile->is_occluded_for_tree_priority(tree_priority_);
1566 bool b_is_occluded = b_tile->is_occluded_for_tree_priority(tree_priority_);
1567 if (a_is_occluded != b_is_occluded)
1568 return b_is_occluded;
1569
1570 // b is lower priorty if it is farther from visible.
1571 return b_priority.distance_to_visible > a_priority.distance_to_visible;
1556 } 1572 }
1557 1573
1558 void TileManager::SetRasterizerForTesting(Rasterizer* rasterizer) { 1574 void TileManager::SetRasterizerForTesting(Rasterizer* rasterizer) {
1559 rasterizer_ = rasterizer; 1575 rasterizer_ = rasterizer;
1560 rasterizer_->SetClient(this); 1576 rasterizer_->SetClient(this);
1561 } 1577 }
1562 1578
1563 bool TileManager::IsReadyToActivate() const { 1579 bool TileManager::IsReadyToActivate() const {
1564 const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); 1580 const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers();
1565 1581
(...skipping 11 matching lines...) Expand all
1577 TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate"); 1593 TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate");
1578 1594
1579 rasterizer_->CheckForCompletedTasks(); 1595 rasterizer_->CheckForCompletedTasks();
1580 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; 1596 did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
1581 1597
1582 if (IsReadyToActivate()) 1598 if (IsReadyToActivate())
1583 client_->NotifyReadyToActivate(); 1599 client_->NotifyReadyToActivate();
1584 } 1600 }
1585 1601
1586 } // namespace cc 1602 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile.h ('k') | cc/resources/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698