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

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: Compiles 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
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 protected: 49 size_t bytes_consumed_if_allocated() const;
77 // Methods called by TileManager.
78 void DeleteVersionOnRequestOfTileManager(int frame_number);
79 50
80 private: 51 private:
52 // Methods called by by tile manager.
53 friend class TileManager;
54 friend class BinComparator;
55 ManagedTileState& managed_state() { return managed_state_; }
56 const ManagedTileState& managed_state() const { return managed_state_; }
57
58 // Normal private methods.
81 friend class base::RefCounted<Tile>; 59 friend class base::RefCounted<Tile>;
82 friend class TileManager;
83
84 TileVersion* GetVersion(int frame_number);
85 ~Tile(); 60 ~Tile();
86 61
87 TileManager* tile_manager_; 62 TileManager* tile_manager_;
63 PicturePile* picture_pile_;
88 gfx::Rect tile_size_; 64 gfx::Rect tile_size_;
89 GLenum format_; 65 GLenum format_;
90 gfx::Rect rect_inside_picture_; 66 gfx::Rect rect_inside_picture_;
91 TileQuality quality_; 67
92 ScopedVector<TileVersion> versions_; 68 TilePriority priority_[2];
93 }; 69 ManagedTileState managed_state_;
70 };
94 71
95 } // namespace cc 72 } // namespace cc
96 73
97 #endif // CC_TILE_H_ 74 #endif // CC_TILE_H_
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/tile.cc » ('j') | cc/tile_priority.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698