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

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

Issue 603683006: cc: Remove low quality mode and cleanup tile versions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 6 years, 2 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
« no previous file with comments | « cc/resources/raster_mode.cc ('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 "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/base/ref_counted_managed.h" 11 #include "cc/base/ref_counted_managed.h"
12 #include "cc/resources/managed_tile_state.h" 12 #include "cc/resources/managed_tile_state.h"
13 #include "cc/resources/picture_pile_impl.h" 13 #include "cc/resources/picture_pile_impl.h"
14 #include "cc/resources/raster_mode.h"
15 #include "cc/resources/tile_priority.h" 14 #include "cc/resources/tile_priority.h"
16 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
17 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
18 17
19 namespace cc { 18 namespace cc {
20 19
21 class CC_EXPORT Tile : public RefCountedManaged<Tile> { 20 class CC_EXPORT Tile : public RefCountedManaged<Tile> {
22 public: 21 public:
23 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 }; 22 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 };
24 23
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void MarkRequiredForActivation(); 86 void MarkRequiredForActivation();
88 87
89 bool required_for_activation() const { 88 bool required_for_activation() const {
90 return priority_[PENDING_TREE].required_for_activation; 89 return priority_[PENDING_TREE].required_for_activation;
91 } 90 }
92 91
93 bool use_picture_analysis() const { 92 bool use_picture_analysis() const {
94 return !!(flags_ & USE_PICTURE_ANALYSIS); 93 return !!(flags_ & USE_PICTURE_ANALYSIS);
95 } 94 }
96 95
97 bool NeedsRasterForMode(RasterMode mode) const { 96 bool HasResources() const { return managed_state_.draw_info.has_resource(); }
98 return !managed_state_.tile_versions[mode].IsReadyToDraw();
99 }
100
101 bool HasResources() const {
102 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) {
103 if (managed_state_.tile_versions[mode].has_resource())
104 return true;
105 }
106 return false;
107 }
108 97
109 void AsValueInto(base::debug::TracedValue* dict) const; 98 void AsValueInto(base::debug::TracedValue* dict) const;
110 99
111 inline bool IsReadyToDraw() const { 100 inline bool IsReadyToDraw() const {
112 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { 101 return managed_state_.draw_info.IsReadyToDraw();
113 if (managed_state_.tile_versions[mode].IsReadyToDraw())
114 return true;
115 }
116 return false;
117 } 102 }
118 103
119 const ManagedTileState::TileVersion& GetTileVersionForDrawing() const { 104 const ManagedTileState::DrawInfo& draw_info() const {
120 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { 105 return managed_state_.draw_info;
121 if (managed_state_.tile_versions[mode].IsReadyToDraw())
122 return managed_state_.tile_versions[mode];
123 }
124 return managed_state_.tile_versions[HIGH_QUALITY_RASTER_MODE];
125 } 106 }
126 107
108 ManagedTileState::DrawInfo& draw_info() { return managed_state_.draw_info; }
109
127 float contents_scale() const { return contents_scale_; } 110 float contents_scale() const { return contents_scale_; }
128 gfx::Rect content_rect() const { return content_rect_; } 111 gfx::Rect content_rect() const { return content_rect_; }
129 112
130 int layer_id() const { return layer_id_; } 113 int layer_id() const { return layer_id_; }
131 114
132 int source_frame_number() const { return source_frame_number_; } 115 int source_frame_number() const { return source_frame_number_; }
133 116
134 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) { 117 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) {
135 DCHECK(pile->CanRaster(contents_scale_, content_rect_)) 118 DCHECK(pile->CanRaster(contents_scale_, content_rect_))
136 << "Recording rect: " 119 << "Recording rect: "
137 << gfx::ScaleToEnclosingRect(content_rect_, 1.f / contents_scale_) 120 << gfx::ScaleToEnclosingRect(content_rect_, 1.f / contents_scale_)
138 .ToString(); 121 .ToString();
139 picture_pile_ = pile; 122 picture_pile_ = pile;
140 } 123 }
141 124
142 size_t GPUMemoryUsageInBytes() const; 125 size_t GPUMemoryUsageInBytes() const;
143 126
144 gfx::Size size() const { return size_; } 127 gfx::Size size() const { return size_; }
145 128
146 RasterMode DetermineRasterModeForTree(WhichTree tree) const;
147 RasterMode DetermineOverallRasterMode() const;
148
149 // Functionality used in tests.
150 RasterMode GetRasterModeForTesting() const {
151 return managed_state().raster_mode;
152 }
153 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) {
154 return managed_state_.tile_versions[mode];
155 }
156
157 private: 129 private:
158 friend class TileManager; 130 friend class TileManager;
159 friend class PrioritizedTileSet; 131 friend class PrioritizedTileSet;
160 friend class FakeTileManager; 132 friend class FakeTileManager;
161 friend class BinComparator; 133 friend class BinComparator;
162 friend class FakePictureLayerImpl; 134 friend class FakePictureLayerImpl;
163 135
164 // Methods called by by tile manager. 136 // Methods called by by tile manager.
165 Tile(TileManager* tile_manager, 137 Tile(TileManager* tile_manager,
166 PicturePileImpl* picture_pile, 138 PicturePileImpl* picture_pile,
167 const gfx::Size& tile_size, 139 const gfx::Size& tile_size,
168 const gfx::Rect& content_rect, 140 const gfx::Rect& content_rect,
169 float contents_scale, 141 float contents_scale,
170 int layer_id, 142 int layer_id,
171 int source_frame_number, 143 int source_frame_number,
172 int flags); 144 int flags);
173 ~Tile(); 145 ~Tile();
174 146
175 ManagedTileState& managed_state() { return managed_state_; } 147 ManagedTileState& managed_state() { return managed_state_; }
176 const ManagedTileState& managed_state() const { return managed_state_; } 148 const ManagedTileState& managed_state() const { return managed_state_; }
177 RasterMode DetermineRasterModeForResolution(TileResolution resolution) const;
178 149
179 bool HasRasterTask() const; 150 bool HasRasterTask() const;
180 151
181 TileManager* tile_manager_; 152 TileManager* tile_manager_;
182 scoped_refptr<PicturePileImpl> picture_pile_; 153 scoped_refptr<PicturePileImpl> picture_pile_;
183 gfx::Size size_; 154 gfx::Size size_;
184 gfx::Rect content_rect_; 155 gfx::Rect content_rect_;
185 float contents_scale_; 156 float contents_scale_;
186 bool is_occluded_[NUM_TREES]; 157 bool is_occluded_[NUM_TREES];
187 158
188 TilePriority priority_[NUM_TREES]; 159 TilePriority priority_[NUM_TREES];
189 ManagedTileState managed_state_; 160 ManagedTileState managed_state_;
190 int layer_id_; 161 int layer_id_;
191 int source_frame_number_; 162 int source_frame_number_;
192 int flags_; 163 int flags_;
193 bool is_shared_; 164 bool is_shared_;
194 165
195 Id id_; 166 Id id_;
196 static Id s_next_id_; 167 static Id s_next_id_;
197 168
198 DISALLOW_COPY_AND_ASSIGN(Tile); 169 DISALLOW_COPY_AND_ASSIGN(Tile);
199 }; 170 };
200 171
201 } // namespace cc 172 } // namespace cc
202 173
203 #endif // CC_RESOURCES_TILE_H_ 174 #endif // CC_RESOURCES_TILE_H_
OLDNEW
« no previous file with comments | « cc/resources/raster_mode.cc ('k') | cc/resources/tile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698