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

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

Issue 22831041: cc: Removed low priority bin from tile management. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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/resources/managed_tile_state.cc ('k') | cc/resources/prioritized_tile_set_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/prioritized_tile_set.h" 5 #include "cc/resources/prioritized_tile_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/resources/managed_tile_state.h" 9 #include "cc/resources/managed_tile_state.h"
10 #include "cc/resources/tile.h" 10 #include "cc/resources/tile.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 class BinComparator { 14 class BinComparator {
15 public: 15 public:
16 bool operator()(const Tile* a, 16 bool operator()(const Tile* a,
17 const Tile* b) const { 17 const Tile* b) const {
18 const ManagedTileState& ams = a->managed_state(); 18 const ManagedTileState& ams = a->managed_state();
19 const ManagedTileState& bms = b->managed_state(); 19 const ManagedTileState& bms = b->managed_state();
20 20
21 if (ams.bin[LOW_PRIORITY_BIN] != bms.bin[LOW_PRIORITY_BIN])
22 return ams.bin[LOW_PRIORITY_BIN] < bms.bin[LOW_PRIORITY_BIN];
23
24 if (ams.required_for_activation != bms.required_for_activation) 21 if (ams.required_for_activation != bms.required_for_activation)
25 return ams.required_for_activation; 22 return ams.required_for_activation;
26 23
27 if (ams.resolution != bms.resolution) 24 if (ams.resolution != bms.resolution)
28 return ams.resolution < bms.resolution; 25 return ams.resolution < bms.resolution;
29 26
30 if (ams.time_to_needed_in_seconds != bms.time_to_needed_in_seconds) 27 if (ams.time_to_needed_in_seconds != bms.time_to_needed_in_seconds)
31 return ams.time_to_needed_in_seconds < bms.time_to_needed_in_seconds; 28 return ams.time_to_needed_in_seconds < bms.time_to_needed_in_seconds;
32 29
33 if (ams.distance_to_visible_in_pixels != 30 if (ams.distance_to_visible_in_pixels !=
(...skipping 10 matching lines...) Expand all
44 } 41 }
45 }; 42 };
46 43
47 namespace { 44 namespace {
48 45
49 typedef std::vector<Tile*> TileVector; 46 typedef std::vector<Tile*> TileVector;
50 47
51 void SortBinTiles(ManagedTileBin bin, TileVector* tiles) { 48 void SortBinTiles(ManagedTileBin bin, TileVector* tiles) {
52 switch (bin) { 49 switch (bin) {
53 case NOW_AND_READY_TO_DRAW_BIN: 50 case NOW_AND_READY_TO_DRAW_BIN:
51 case NEVER_BIN:
54 break; 52 break;
55 case NOW_BIN: 53 case NOW_BIN:
56 case SOON_BIN: 54 case SOON_BIN:
57 case EVENTUALLY_AND_ACTIVE_BIN: 55 case EVENTUALLY_AND_ACTIVE_BIN:
58 case EVENTUALLY_BIN: 56 case EVENTUALLY_BIN:
59 case NEVER_AND_ACTIVE_BIN: 57 case AT_LAST_AND_ACTIVE_BIN:
60 case NEVER_BIN: 58 case AT_LAST_BIN:
61 std::sort(tiles->begin(), tiles->end(), BinComparator()); 59 std::sort(tiles->begin(), tiles->end(), BinComparator());
62 break; 60 break;
63 default: 61 case NUM_BINS:
reveman 2013/08/26 23:22:13 nit: "default: NOTREACHED()" would be more consist
danakj 2013/08/27 02:23:43 :(
64 NOTREACHED(); 62 NOTREACHED();
65 } 63 }
66 } 64 }
67 65
68 } // namespace 66 } // namespace
69 67
70 PrioritizedTileSet::PrioritizedTileSet() { 68 PrioritizedTileSet::PrioritizedTileSet() {
71 for (int bin = 0; bin < NUM_BINS; ++bin) 69 for (int bin = 0; bin < NUM_BINS; ++bin)
72 bin_sorted_[bin] = true; 70 bin_sorted_[bin] = true;
73 } 71 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (use_priority_ordering_) 134 if (use_priority_ordering_)
137 tile_set_->SortBinIfNeeded(current_bin_); 135 tile_set_->SortBinIfNeeded(current_bin_);
138 136
139 iterator_ = tile_set_->tiles_[current_bin_].begin(); 137 iterator_ = tile_set_->tiles_[current_bin_].begin();
140 if (iterator_ != tile_set_->tiles_[current_bin_].end()) 138 if (iterator_ != tile_set_->tiles_[current_bin_].end())
141 break; 139 break;
142 } 140 }
143 } 141 }
144 142
145 } // namespace cc 143 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/managed_tile_state.cc ('k') | cc/resources/prioritized_tile_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698