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

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

Issue 817133006: Support different formats in the same resource pool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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_MANAGER_H_ 5 #ifndef CC_RESOURCES_TILE_MANAGER_H_
6 #define CC_RESOURCES_TILE_MANAGER_H_ 6 #define CC_RESOURCES_TILE_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 scoped_refptr<base::debug::ConvertableToTraceFormat> BasicStateAsValue() 129 scoped_refptr<base::debug::ConvertableToTraceFormat> BasicStateAsValue()
130 const; 130 const;
131 void BasicStateAsValueInto(base::debug::TracedValue* dict) const; 131 void BasicStateAsValueInto(base::debug::TracedValue* dict) const;
132 const MemoryHistory::Entry& memory_stats_from_last_assign() const { 132 const MemoryHistory::Entry& memory_stats_from_last_assign() const {
133 return memory_stats_from_last_assign_; 133 return memory_stats_from_last_assign_;
134 } 134 }
135 135
136 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { 136 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) {
137 for (size_t i = 0; i < tiles.size(); ++i) { 137 for (size_t i = 0; i < tiles.size(); ++i) {
138 TileDrawInfo& draw_info = tiles[i]->draw_info(); 138 TileDrawInfo& draw_info = tiles[i]->draw_info();
139 draw_info.resource_ = 139 draw_info.resource_ = resource_pool_->AcquireResource(
140 resource_pool_->AcquireResource(tiles[i]->desired_texture_size()); 140 tiles[i]->desired_texture_size(), FORMAT_USAGE_NATIVE);
141 } 141 }
142 } 142 }
143 143
144 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { 144 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) {
145 for (size_t i = 0; i < tiles.size(); ++i) { 145 for (size_t i = 0; i < tiles.size(); ++i) {
146 Tile* tile = tiles[i]; 146 Tile* tile = tiles[i];
147 FreeResourcesForTile(tile); 147 FreeResourcesForTile(tile);
148 } 148 }
149 } 149 }
150 150
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 SkPixelRef* pixel_ref, 231 SkPixelRef* pixel_ref,
232 bool was_canceled); 232 bool was_canceled);
233 void OnRasterTaskCompleted(Tile::Id tile, 233 void OnRasterTaskCompleted(Tile::Id tile,
234 scoped_ptr<ScopedResource> resource, 234 scoped_ptr<ScopedResource> resource,
235 const RasterSource::SolidColorAnalysis& analysis, 235 const RasterSource::SolidColorAnalysis& analysis,
236 bool was_canceled); 236 bool was_canceled);
237 void UpdateTileDrawInfo(Tile* tile, 237 void UpdateTileDrawInfo(Tile* tile,
238 scoped_ptr<ScopedResource> resource, 238 scoped_ptr<ScopedResource> resource,
239 const RasterSource::SolidColorAnalysis& analysis); 239 const RasterSource::SolidColorAnalysis& analysis);
240 240
241 ResourceFormatUsage DetermineResourceFormatUsage(const Tile* tile) const;
241 void FreeResourcesForTile(Tile* tile); 242 void FreeResourcesForTile(Tile* tile);
242 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); 243 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile);
243 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, 244 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile,
244 SkPixelRef* pixel_ref); 245 SkPixelRef* pixel_ref);
245 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); 246 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile);
246 247
247 void RebuildEvictionQueueIfNeeded(); 248 void RebuildEvictionQueueIfNeeded();
248 bool FreeTileResourcesUntilUsageIsWithinLimit(const MemoryUsage& limit, 249 bool FreeTileResourcesUntilUsageIsWithinLimit(const MemoryUsage& limit,
249 MemoryUsage* usage); 250 MemoryUsage* usage);
250 bool FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( 251 bool FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 309
309 bool did_notify_ready_to_activate_; 310 bool did_notify_ready_to_activate_;
310 bool did_notify_ready_to_draw_; 311 bool did_notify_ready_to_draw_;
311 312
312 DISALLOW_COPY_AND_ASSIGN(TileManager); 313 DISALLOW_COPY_AND_ASSIGN(TileManager);
313 }; 314 };
314 315
315 } // namespace cc 316 } // namespace cc
316 317
317 #endif // CC_RESOURCES_TILE_MANAGER_H_ 318 #endif // CC_RESOURCES_TILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698