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

Side by Side Diff: cc/tile.h

Issue 11417002: First draft of TileManager's tile prioritzation system (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/picture_layer_impl.cc ('k') | cc/tile.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 #ifndef CC_TILE_H_ 5 #ifndef CC_TILE_H_
6 #define CC_TILE_H_ 6 #define CC_TILE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "cc/layer_tree_host_impl.h"
11 #include "cc/picture_pile.h" 12 #include "cc/picture_pile.h"
12 #include "cc/resource_provider.h" 13 #include "cc/resource_provider.h"
14 #include "cc/tile_manager.h"
13 #include "cc/tile_priority.h" 15 #include "cc/tile_priority.h"
14 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
15 #include "ui/gfx/size.h" 17 #include "ui/gfx/size.h"
16 18
17 namespace cc { 19 namespace cc {
18 20
19 class Tile; 21 class Tile;
20 class TileManager;
21 22
22 enum TileQuality { 23 class Tile : public base::RefCounted<Tile> {
23 LOW_TILE_QUALITY, 24 public:
24 NORMAL_TILE_QUALITY 25 Tile(TileManager* tile_manager,
25 }; 26 PicturePile* picture_pile,
26 27 gfx::Size tile_size,
27 class TileVersion { 28 GLenum format,
28 public: 29 gfx::Rect rect_inside_picture);
29 TileVersion(Tile* tile, int frame_number,
30 PicturePile* picture_pile)
31 : tile_(tile),
32 frame_number_(frame_number),
33 picture_pile_(picture_pile),
34 resource_id_(0) {}
35
36 int frame_number() const { return frame_number_; }
37 30
38 const PicturePile* picture_pile() const { 31 const PicturePile* picture_pile() const {
39 return picture_pile_; 32 return picture_pile_;
40 } 33 }
41 34
42 const TilePriority& priority() const { 35 const TilePriority& priority(WhichTree tree) const {
43 return priority_; 36 return priority_[tree];
44 } 37 }
45 38
46 void ModifyPriority(const TilePriority& priority) { 39 TilePriority combined_priority() const {
47 priority_ = priority; 40 return TilePriority(priority_[ACTIVE_TREE],
41 priority_[PENDING_TREE]);
48 } 42 }
49 43
50 ResourceProvider::ResourceId resource_id() const { 44 void set_priority(WhichTree tree, const TilePriority& priority);
51 return resource_id_;
52 }
53
54 private:
55 Tile* tile_;
56 int frame_number_;
57 PicturePile* picture_pile_;
58 TilePriority priority_;
59 ResourceProvider::ResourceId resource_id_;
60 };
61
62 class Tile : public base::RefCounted<Tile> {
63 public:
64 Tile(TileManager* tile_manager,
65 gfx::Size tile_size,
66 GLenum format,
67 gfx::Rect rect_inside_picture,
68 TileQuality quality);
69
70 void SetPicturePile(int frame_number, PicturePile* picture_pile);
71 void ModifyPriority(int frame_number, const TilePriority& priority);
72 45
73 // Returns 0 if not drawable. 46 // Returns 0 if not drawable.
74 ResourceProvider::ResourceId GetDrawableResourceId(int frame_number); 47 ResourceProvider::ResourceId resource_id() const { return managed_state_.resou rce_id; }
75 48
76 const gfx::Rect& opaque_rect() const { return opaque_rect_; } 49 const gfx::Rect& opaque_rect() const { return opaque_rect_; }
50
77 // TODO(enne): Make this real 51 // TODO(enne): Make this real
78 bool contents_swizzled() const { return false; } 52 bool contents_swizzled() const { return false; }
79 53
80 protected: 54 private:
81 // Methods called by TileManager. 55 // Methods called by by tile manager.
82 void DeleteVersionOnRequestOfTileManager(int frame_number); 56 friend class TileManager;
57 friend class BinComparator;
58 ManagedTileState& managed_state() { return managed_state_; }
59 const ManagedTileState& managed_state() const { return managed_state_; }
60 size_t bytes_consumed_if_allocated() const;
83 61
84 private: 62 // Normal private methods.
85 friend class base::RefCounted<Tile>; 63 friend class base::RefCounted<Tile>;
86 friend class TileManager;
87
88 TileVersion* GetVersion(int frame_number);
89 ~Tile(); 64 ~Tile();
90 65
91 TileManager* tile_manager_; 66 TileManager* tile_manager_;
67 PicturePile* picture_pile_;
92 gfx::Rect tile_size_; 68 gfx::Rect tile_size_;
93 GLenum format_; 69 GLenum format_;
94 gfx::Rect rect_inside_picture_; 70 gfx::Rect rect_inside_picture_;
95 gfx::Rect opaque_rect_; 71 gfx::Rect opaque_rect_;
96 TileQuality quality_; 72
97 ScopedVector<TileVersion> versions_; 73 TilePriority priority_[2];
74 ManagedTileState managed_state_;
98 }; 75 };
99 76
100 } // namespace cc 77 } // namespace cc
101 78
102 #endif // CC_TILE_H_ 79 #endif // CC_TILE_H_
OLDNEW
« no previous file with comments | « cc/picture_layer_impl.cc ('k') | cc/tile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698