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 "cc/base/ref_counted_managed.h" |
9 #include "cc/resources/raster_source.h" | 10 #include "cc/resources/raster_source.h" |
10 #include "cc/resources/tile_draw_info.h" | 11 #include "cc/resources/tile_draw_info.h" |
11 #include "cc/resources/tile_priority.h" | 12 #include "cc/resources/tile_priority.h" |
12 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 class TileManager; | 18 class TileManager; |
18 | 19 |
19 class CC_EXPORT Tile { | 20 class CC_EXPORT Tile : public RefCountedManaged<Tile> { |
20 public: | 21 public: |
21 class Deleter { | |
22 public: | |
23 void operator()(Tile* tile) const; | |
24 }; | |
25 | |
26 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 }; | 22 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 }; |
27 | 23 |
28 typedef uint64 Id; | 24 typedef uint64 Id; |
29 | 25 |
30 Id id() const { | 26 Id id() const { |
31 return id_; | 27 return id_; |
32 } | 28 } |
33 | 29 |
34 RasterSource* raster_source() { return raster_source_.get(); } | 30 RasterSource* raster_source() { return raster_source_.get(); } |
35 | 31 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 89 |
94 void set_tiling_index(int i, int j) { | 90 void set_tiling_index(int i, int j) { |
95 tiling_i_index_ = i; | 91 tiling_i_index_ = i; |
96 tiling_j_index_ = j; | 92 tiling_j_index_ = j; |
97 } | 93 } |
98 int tiling_i_index() const { return tiling_i_index_; } | 94 int tiling_i_index() const { return tiling_i_index_; } |
99 int tiling_j_index() const { return tiling_j_index_; } | 95 int tiling_j_index() const { return tiling_j_index_; } |
100 | 96 |
101 private: | 97 private: |
102 friend class TileManager; | 98 friend class TileManager; |
| 99 friend class PrioritizedTileSet; |
103 friend class FakeTileManager; | 100 friend class FakeTileManager; |
| 101 friend class BinComparator; |
104 friend class FakePictureLayerImpl; | 102 friend class FakePictureLayerImpl; |
105 | 103 |
106 // Methods called by by tile manager. | 104 // Methods called by by tile manager. |
107 Tile(TileManager* tile_manager, | 105 Tile(TileManager* tile_manager, |
108 RasterSource* raster_source, | 106 RasterSource* raster_source, |
109 const gfx::Size& desired_texture_size, | 107 const gfx::Size& desired_texture_size, |
110 const gfx::Rect& content_rect, | 108 const gfx::Rect& content_rect, |
111 float contents_scale, | 109 float contents_scale, |
112 int layer_id, | 110 int layer_id, |
113 int source_frame_number, | 111 int source_frame_number, |
114 int flags); | 112 int flags); |
115 ~Tile(); | 113 ~Tile(); |
116 | 114 |
117 bool HasRasterTask() const { return !!raster_task_.get(); } | 115 bool HasRasterTask() const { return !!raster_task_.get(); } |
118 | 116 |
119 TileManager* tile_manager_; | |
120 scoped_refptr<RasterSource> raster_source_; | 117 scoped_refptr<RasterSource> raster_source_; |
121 gfx::Size desired_texture_size_; | 118 gfx::Size desired_texture_size_; |
122 gfx::Rect content_rect_; | 119 gfx::Rect content_rect_; |
123 float contents_scale_; | 120 float contents_scale_; |
124 bool is_occluded_; | 121 bool is_occluded_; |
125 | 122 |
126 TilePriority priority_; | 123 TilePriority priority_; |
127 TileDrawInfo draw_info_; | 124 TileDrawInfo draw_info_; |
128 | 125 |
129 int layer_id_; | 126 int layer_id_; |
130 int source_frame_number_; | 127 int source_frame_number_; |
131 int flags_; | 128 int flags_; |
132 int tiling_i_index_; | 129 int tiling_i_index_; |
133 int tiling_j_index_; | 130 int tiling_j_index_; |
134 bool required_for_activation_ : 1; | 131 bool required_for_activation_ : 1; |
135 bool required_for_draw_ : 1; | 132 bool required_for_draw_ : 1; |
136 | 133 |
137 Id id_; | 134 Id id_; |
138 static Id s_next_id_; | 135 static Id s_next_id_; |
139 | 136 |
140 unsigned scheduled_priority_; | 137 unsigned scheduled_priority_; |
141 | 138 |
142 scoped_refptr<RasterTask> raster_task_; | 139 scoped_refptr<RasterTask> raster_task_; |
143 | 140 |
144 DISALLOW_COPY_AND_ASSIGN(Tile); | 141 DISALLOW_COPY_AND_ASSIGN(Tile); |
145 }; | 142 }; |
146 | 143 |
147 using ScopedTilePtr = scoped_ptr<Tile, Tile::Deleter>; | |
148 | |
149 } // namespace cc | 144 } // namespace cc |
150 | 145 |
151 #endif // CC_RESOURCES_TILE_H_ | 146 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |