OLD | NEW |
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_RESOURCES_TILE_H_ | 5 #ifndef CC_RESOURCES_TILE_H_ |
6 #define CC_RESOURCES_TILE_H_ | 6 #define CC_RESOURCES_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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 int layer_id() const { return layer_id_; } | 92 int layer_id() const { return layer_id_; } |
93 | 93 |
94 int source_frame_number() const { return source_frame_number_; } | 94 int source_frame_number() const { return source_frame_number_; } |
95 | 95 |
96 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) { | 96 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) { |
97 DCHECK(pile->CanRaster(contents_scale_, content_rect_)); | 97 DCHECK(pile->CanRaster(contents_scale_, content_rect_)); |
98 picture_pile_ = pile; | 98 picture_pile_ = pile; |
99 } | 99 } |
100 | 100 |
101 // For test only methods. | |
102 bool HasRasterTaskForTesting() const { | |
103 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { | |
104 if (!managed_state().tile_versions[mode].raster_task_.is_null()) | |
105 return true; | |
106 } | |
107 return false; | |
108 } | |
109 void ResetRasterTaskForTesting() { | |
110 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) | |
111 managed_state().tile_versions[mode].raster_task_.Reset(); | |
112 } | |
113 | |
114 private: | 101 private: |
115 // Methods called by by tile manager. | 102 // Methods called by by tile manager. |
116 friend class TileManager; | 103 friend class TileManager; |
| 104 friend class FakeTileManager; |
117 friend class BinComparator; | 105 friend class BinComparator; |
118 ManagedTileState& managed_state() { return managed_state_; } | 106 ManagedTileState& managed_state() { return managed_state_; } |
119 const ManagedTileState& managed_state() const { return managed_state_; } | 107 const ManagedTileState& managed_state() const { return managed_state_; } |
120 | 108 |
121 inline size_t bytes_consumed_if_allocated() const { | 109 inline size_t bytes_consumed_if_allocated() const { |
122 return 4 * tile_size_.width() * tile_size_.height(); | 110 return 4 * tile_size_.width() * tile_size_.height(); |
123 } | 111 } |
124 | 112 |
125 | 113 |
126 // Normal private methods. | 114 // Normal private methods. |
(...skipping 11 matching lines...) Expand all Loading... |
138 ManagedTileState managed_state_; | 126 ManagedTileState managed_state_; |
139 int layer_id_; | 127 int layer_id_; |
140 int source_frame_number_; | 128 int source_frame_number_; |
141 | 129 |
142 DISALLOW_COPY_AND_ASSIGN(Tile); | 130 DISALLOW_COPY_AND_ASSIGN(Tile); |
143 }; | 131 }; |
144 | 132 |
145 } // namespace cc | 133 } // namespace cc |
146 | 134 |
147 #endif // CC_RESOURCES_TILE_H_ | 135 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |