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

Side by Side Diff: cc/resources/tile.h

Issue 793573006: Refactoring for merging ManagedTileState into Tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename HasResources to HasResource Created 6 years 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
« no previous file with comments | « cc/resources/raster_source.h ('k') | cc/resources/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_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/base/ref_counted_managed.h"
10 #include "cc/resources/managed_tile_state.h"
11 #include "cc/resources/raster_source.h" 10 #include "cc/resources/raster_source.h"
11 #include "cc/resources/tile_draw_info.h"
12 #include "cc/resources/tile_priority.h" 12 #include "cc/resources/tile_priority.h"
13 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
14 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
15 15
16 namespace cc { 16 namespace cc {
17 17
18 class TileManager; 18 class TileManager;
19 19
20 class CC_EXPORT Tile : public RefCountedManaged<Tile> { 20 class CC_EXPORT Tile : public RefCountedManaged<Tile> {
21 public: 21 public:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 bool required_for_draw() const { return required_for_draw_; } 90 bool required_for_draw() const { return required_for_draw_; }
91 void set_required_for_draw(bool is_required) { 91 void set_required_for_draw(bool is_required) {
92 required_for_draw_ = is_required; 92 required_for_draw_ = is_required;
93 } 93 }
94 94
95 bool use_picture_analysis() const { 95 bool use_picture_analysis() const {
96 return !!(flags_ & USE_PICTURE_ANALYSIS); 96 return !!(flags_ & USE_PICTURE_ANALYSIS);
97 } 97 }
98 98
99 bool HasResources() const { return managed_state_.draw_info.has_resource(); } 99 bool HasActiveTask() const { return raster_task.get() != 0; }
vmpstr 2014/12/18 21:34:13 This is the same as HasRasterTask.
JungJik 2014/12/19 10:06:50 Done.
100 bool HasResource() const { return draw_info_.has_resource(); }
100 bool NeedsRaster() const { 101 bool NeedsRaster() const {
101 return managed_state_.draw_info.mode() == 102 return draw_info_.mode() == TileDrawInfo::PICTURE_PILE_MODE ||
102 ManagedTileState::DrawInfo::PICTURE_PILE_MODE || 103 !draw_info_.IsReadyToDraw();
103 !managed_state_.draw_info.IsReadyToDraw();
104 } 104 }
105 105
106 void AsValueInto(base::debug::TracedValue* dict) const; 106 void AsValueInto(base::debug::TracedValue* dict) const;
107 107
108 inline bool IsReadyToDraw() const { 108 inline bool IsReadyToDraw() const { return draw_info_.IsReadyToDraw(); }
109 return managed_state_.draw_info.IsReadyToDraw();
110 }
111 109
112 const ManagedTileState::DrawInfo& draw_info() const { 110 const TileDrawInfo& draw_info() const { return draw_info_; }
113 return managed_state_.draw_info;
114 }
115 111
116 ManagedTileState::DrawInfo& draw_info() { return managed_state_.draw_info; } 112 TileDrawInfo& draw_info() { return draw_info_; }
117 113
118 float contents_scale() const { return contents_scale_; } 114 float contents_scale() const { return contents_scale_; }
119 gfx::Rect content_rect() const { return content_rect_; } 115 gfx::Rect content_rect() const { return content_rect_; }
120 116
121 int layer_id() const { return layer_id_; } 117 int layer_id() const { return layer_id_; }
122 118
123 int source_frame_number() const { return source_frame_number_; } 119 int source_frame_number() const { return source_frame_number_; }
124 120
125 void set_raster_source(scoped_refptr<RasterSource> raster_source) { 121 void set_raster_source(scoped_refptr<RasterSource> raster_source) {
126 DCHECK(raster_source->CoversRect(content_rect_, contents_scale_)) 122 DCHECK(raster_source->CoversRect(content_rect_, contents_scale_))
(...skipping 25 matching lines...) Expand all
152 Tile(TileManager* tile_manager, 148 Tile(TileManager* tile_manager,
153 RasterSource* raster_source, 149 RasterSource* raster_source,
154 const gfx::Size& tile_size, 150 const gfx::Size& tile_size,
155 const gfx::Rect& content_rect, 151 const gfx::Rect& content_rect,
156 float contents_scale, 152 float contents_scale,
157 int layer_id, 153 int layer_id,
158 int source_frame_number, 154 int source_frame_number,
159 int flags); 155 int flags);
160 ~Tile(); 156 ~Tile();
161 157
162 ManagedTileState& managed_state() { return managed_state_; }
163 const ManagedTileState& managed_state() const { return managed_state_; }
164
165 bool HasRasterTask() const; 158 bool HasRasterTask() const;
166 159
167 TileManager* tile_manager_; 160 TileManager* tile_manager_;
168 scoped_refptr<RasterSource> raster_source_; 161 scoped_refptr<RasterSource> raster_source_;
169 gfx::Size size_; 162 gfx::Size size_;
170 gfx::Rect content_rect_; 163 gfx::Rect content_rect_;
171 float contents_scale_; 164 float contents_scale_;
172 bool is_occluded_[NUM_TREES]; 165 bool is_occluded_[NUM_TREES];
173 166
174 TilePriority priority_[NUM_TREES]; 167 TilePriority priority_[NUM_TREES];
175 ManagedTileState managed_state_; 168 TileDrawInfo draw_info_;
169
176 int layer_id_; 170 int layer_id_;
177 int source_frame_number_; 171 int source_frame_number_;
178 int flags_; 172 int flags_;
179 bool is_shared_; 173 bool is_shared_;
180 int tiling_i_index_; 174 int tiling_i_index_;
181 int tiling_j_index_; 175 int tiling_j_index_;
182 bool required_for_activation_; 176 bool required_for_activation_;
183 bool required_for_draw_; 177 bool required_for_draw_;
184 178
185 Id id_; 179 Id id_;
186 static Id s_next_id_; 180 static Id s_next_id_;
187 181
182 unsigned scheduled_priority;
vmpstr 2014/12/18 21:34:13 This should have a trailing underscore.
JungJik 2014/12/19 10:06:50 Done.
183
184 scoped_refptr<RasterTask> raster_task;
vmpstr 2014/12/18 21:34:13 This should have a trailing underscore.
JungJik 2014/12/19 10:06:50 Done. PTAL. thanks for the review.
185
188 DISALLOW_COPY_AND_ASSIGN(Tile); 186 DISALLOW_COPY_AND_ASSIGN(Tile);
189 }; 187 };
190 188
191 } // namespace cc 189 } // namespace cc
192 190
193 #endif // CC_RESOURCES_TILE_H_ 191 #endif // CC_RESOURCES_TILE_H_
OLDNEW
« no previous file with comments | « cc/resources/raster_source.h ('k') | cc/resources/tile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698