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

Side by Side Diff: cc/tile_priority.h

Issue 11364194: Introduce Tile Versions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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/tile_manager.cc ('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 #ifndef CC_TILE_PRIORTY_H_ 5 #ifndef CC_TILE_PRIORTY_H_
6 #define CC_TILE_PRIORTY_H_ 6 #define CC_TILE_PRIORTY_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "cc/picture_pile.h" 9 #include "cc/picture_pile.h"
10 #include "cc/tile_priority.h"
11 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
12 #include "ui/gfx/size.h" 11 #include "ui/gfx/size.h"
13 12
14 namespace cc { 13 namespace cc {
15 14
16 struct TilePriority { 15 struct TilePriority {
16 // Set to true for tiles that should be favored during, for example,
17 // scrolls.
18 bool on_primary_tree;
19
17 // A given layer may have multiple tilings, of differing quality. 20 // A given layer may have multiple tilings, of differing quality.
18 // would_be_drawn is set for the tiles that are visible that would be 21 // would_be_drawn is set for the tiles that are visible that would be
19 // drawn if they were chosen. 22 // drawn if they were chosen.
20 bool would_be_drawn; 23 bool would_be_drawn;
21 24
22 // Set to true for tiles that should be favored during, for example, 25 // We expect it to be useful soon.
23 // scrolls. 26 bool nice_to_have;
24 bool on_primary_tree;
25 27
26 // Used to prefer tiles near to the viewport. 28 // Used to prefer tiles near to the viewport.
27 float distance_to_viewport; 29 float distance_to_viewport;
28 30
29 // TODO(enne): some metric that penalizes blurriness. 31 // TODO(enne): some metric that penalizes blurriness.
30 }; 32 };
31 33
34 enum TileMemoryLimitPolicy {
35 // Nothing.
36 ALLOW_NOTHING,
37
38 // Use as little as possible.
39 ALLOW_ONLY_REQUIRED, // On primary tree, would be drawn.
40
41 // Use as little as possible.
42 ALLOW_NICE_TO_HAVE, // On either tree, nice to have
43
44 // Use as much memory, up to memory size.
45 ALLOW_ANYTHING,
46 };
47
48 class GlobalStateThatImpactsTilePriority {
49 public:
50 GlobalStateThatImpactsTilePriority()
51 : memory_limit_policy(ALLOW_NOTHING)
52 , memory_limit_in_bytes(0)
53 , smoothness_takes_priority(false)
54 , pending_tree_frame_number(-1)
55 , active_tree_frame_number(-1) {
56 }
57
58 TileMemoryLimitPolicy memory_limit_policy;
59
60 size_t memory_limit_in_bytes;
61
62 // Set when scrolling.
63 bool smoothness_takes_priority;
64
65 // Use -1 if no tree.
66 int pending_tree_frame_number;
67 int active_tree_frame_number;
68 };
69
32 class TilePriorityComparator { 70 class TilePriorityComparator {
33 public: 71 public:
34 TilePriorityComparator(bool currently_scrolling) 72 TilePriorityComparator(GlobalStateThatImpactsTilePriority& global_state)
35 : currently_scrolling_(currently_scrolling) {} 73 : global_state_(global_state) {}
36 74
37 int compare(const TilePriority& a, const TilePriority& b) { 75 int compare(const TilePriority& a, const TilePriority& b) {
38 // TODO(nduca,enne): Implement a comparator using the attributes here. 76 // TODO(nduca,enne): Implement a comparator using the attributes here.
39 return 0; 77 return 0;
40 } 78 }
41 79
42 private: 80 private:
43 bool currently_scrolling_; 81 GlobalStateThatImpactsTilePriority global_state_;
44 }; 82 };
45 83
46 } // namespace cc 84 } // namespace cc
47 #endif 85 #endif
OLDNEW
« no previous file with comments | « cc/tile_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698