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

Side by Side Diff: cc/tile.h

Issue 12289020: cc: Make the TileManager operate on ManagedTileState directly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix clang dtor nits Created 7 years, 10 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/picture_layer_tiling_set_unittest.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"
(...skipping 12 matching lines...) Expand all
23 class CC_EXPORT Tile : public base::RefCounted<Tile> { 23 class CC_EXPORT Tile : public base::RefCounted<Tile> {
24 public: 24 public:
25 Tile(TileManager* tile_manager, 25 Tile(TileManager* tile_manager,
26 PicturePileImpl* picture_pile, 26 PicturePileImpl* picture_pile,
27 gfx::Size tile_size, 27 gfx::Size tile_size,
28 GLenum format, 28 GLenum format,
29 gfx::Rect content_rect, 29 gfx::Rect content_rect,
30 gfx::Rect opaque_rect, 30 gfx::Rect opaque_rect,
31 float contents_scale); 31 float contents_scale);
32 32
33 TileManager* tile_manager() {
34 return tile_manager_;
35 }
36
33 PicturePileImpl* picture_pile() { 37 PicturePileImpl* picture_pile() {
34 return picture_pile_.get(); 38 return picture_pile_.get();
35 } 39 }
36 40
37 const TilePriority& priority(WhichTree tree) const { 41 const TilePriority& priority(WhichTree tree) const {
38 return priority_[tree]; 42 return priority_[tree];
39 } 43 }
40 44
41 TilePriority combined_priority() const { 45 TilePriority combined_priority() const {
42 return TilePriority(priority_[ACTIVE_TREE], 46 return TilePriority(priority_[ACTIVE_TREE],
43 priority_[PENDING_TREE]); 47 priority_[PENDING_TREE]);
44 } 48 }
45 49
46 void set_priority(WhichTree tree, const TilePriority& priority) { 50 void set_priority(WhichTree tree, const TilePriority& priority) {
47 tile_manager_->WillModifyTilePriority(this, tree, priority); 51 tile_manager_->WillModifyTilePriority(this, tree, priority);
48 priority_[tree] = priority; 52 priority_[tree] = priority;
49 } 53 }
50 54
51 scoped_ptr<base::Value> AsValue() const; 55 scoped_ptr<base::Value> AsValue() const;
52 56
53 // Returns 0 if not drawable. 57 // Returns 0 if not drawable.
54 ResourceProvider::ResourceId GetResourceId() const { 58 ResourceProvider::ResourceId GetResourceId() const {
55 if (!managed_state_.resource) 59 if (!managed_state_)
56 return 0; 60 return 0;
57 if (managed_state_.resource_is_being_initialized) 61 if (!managed_state_->resource)
62 return 0;
63 if (managed_state_->resource_is_being_initialized)
58 return 0; 64 return 0;
59 65
60 return managed_state_.resource->id(); 66 return managed_state_->resource->id();
61 } 67 }
62 68
63 const gfx::Rect& opaque_rect() const { return opaque_rect_; } 69 const gfx::Rect& opaque_rect() const { return opaque_rect_; }
64 70
65 bool contents_swizzled() const { return managed_state_.contents_swizzled; } 71 bool contents_swizzled() const { return managed_state_->contents_swizzled; }
66 72
67 float contents_scale() const { return contents_scale_; } 73 float contents_scale() const { return contents_scale_; }
68 gfx::Rect content_rect() const { return content_rect_; } 74 gfx::Rect content_rect() const { return content_rect_; }
69 75
70 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) { 76 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) {
71 picture_pile_ = pile; 77 picture_pile_ = pile;
72 } 78 }
73 79
74 ManagedTileState& ManagedStateForTesting() { return managed_state_; } 80 ManagedTileState* ManagedStateForTesting() { return managed_state_; }
75 81
76 private: 82 private:
77 // Methods called by by tile manager. 83 // Methods called by by tile manager.
78 friend class TileManager; 84 friend class TileManager;
79 friend class BinComparator; 85 friend class BinComparator;
80 ManagedTileState& managed_state() { return managed_state_; } 86 ManagedTileState* managed_state() { return managed_state_; }
81 const ManagedTileState& managed_state() const { return managed_state_; } 87 const ManagedTileState* managed_state() const { return managed_state_; }
82 88
83 inline size_t bytes_consumed_if_allocated() const { 89 inline size_t bytes_consumed_if_allocated() const {
84 DCHECK(format_ == GL_RGBA); 90 DCHECK(format_ == GL_RGBA);
85 return 4 * tile_size_.width() * tile_size_.height(); 91 return 4 * tile_size_.width() * tile_size_.height();
86 } 92 }
87 93
88 94
89 // Normal private methods. 95 // Normal private methods.
90 friend class base::RefCounted<Tile>; 96 friend class base::RefCounted<Tile>;
91 ~Tile(); 97 ~Tile();
92 98
93 TileManager* tile_manager_; 99 TileManager* tile_manager_;
94 scoped_refptr<PicturePileImpl> picture_pile_; 100 scoped_refptr<PicturePileImpl> picture_pile_;
95 gfx::Rect tile_size_; 101 gfx::Rect tile_size_;
96 GLenum format_; 102 GLenum format_;
97 gfx::Rect content_rect_; 103 gfx::Rect content_rect_;
98 float contents_scale_; 104 float contents_scale_;
99 gfx::Rect opaque_rect_; 105 gfx::Rect opaque_rect_;
100 106
101 TilePriority priority_[NUM_BIN_PRIORITIES]; 107 TilePriority priority_[NUM_BIN_PRIORITIES];
102 ManagedTileState managed_state_; 108 ManagedTileState* managed_state_;
103 }; 109 };
104 110
105 } // namespace cc 111 } // namespace cc
106 112
107 #endif // CC_TILE_H_ 113 #endif // CC_TILE_H_
OLDNEW
« no previous file with comments | « cc/picture_layer_tiling_set_unittest.cc ('k') | cc/tile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698