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

Side by Side Diff: cc/tiles/software_image_decode_controller.h

Issue 1808633002: Use preferred format to allocate memory for decoded images (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ 5 #ifndef CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_
6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ 6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 size_t operator()(const ImageDecodeControllerKey& key) const { 89 size_t operator()(const ImageDecodeControllerKey& key) const {
90 return key.get_hash(); 90 return key.get_hash();
91 } 91 }
92 }; 92 };
93 93
94 class CC_EXPORT SoftwareImageDecodeController : public ImageDecodeController { 94 class CC_EXPORT SoftwareImageDecodeController : public ImageDecodeController {
95 public: 95 public:
96 using ImageKey = ImageDecodeControllerKey; 96 using ImageKey = ImageDecodeControllerKey;
97 using ImageKeyHash = ImageDecodeControllerKeyHash; 97 using ImageKeyHash = ImageDecodeControllerKeyHash;
98 98
99 SoftwareImageDecodeController(); 99 explicit SoftwareImageDecodeController(ResourceFormat format = RGBA_8888);
100 ~SoftwareImageDecodeController() override; 100 ~SoftwareImageDecodeController() override;
101 101
102 // ImageDecodeController overrides. 102 // ImageDecodeController overrides.
103 bool GetTaskForImageAndRef(const DrawImage& image, 103 bool GetTaskForImageAndRef(const DrawImage& image,
104 uint64_t prepare_tiles_id, 104 uint64_t prepare_tiles_id,
105 scoped_refptr<ImageDecodeTask>* task) override; 105 scoped_refptr<ImageDecodeTask>* task) override;
106 void UnrefImage(const DrawImage& image) override; 106 void UnrefImage(const DrawImage& image) override;
107 DecodedDrawImage GetDecodedImageForDraw(const DrawImage& image) override; 107 DecodedDrawImage GetDecodedImageForDraw(const DrawImage& image) override;
108 void DrawWithImageFinished(const DrawImage& image, 108 void DrawWithImageFinished(const DrawImage& image,
109 const DecodedDrawImage& decoded_image) override; 109 const DecodedDrawImage& decoded_image) override;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 ImageMRUCache at_raster_decoded_images_; 214 ImageMRUCache at_raster_decoded_images_;
215 std::unordered_map<ImageKey, int, ImageKeyHash> 215 std::unordered_map<ImageKey, int, ImageKeyHash>
216 at_raster_decoded_images_ref_counts_; 216 at_raster_decoded_images_ref_counts_;
217 217
218 MemoryBudget locked_images_budget_; 218 MemoryBudget locked_images_budget_;
219 219
220 // Note that this is used for cases where the only thing we do is preroll the 220 // Note that this is used for cases where the only thing we do is preroll the
221 // image the first time we see it. This mimics the previous behavior and 221 // image the first time we see it. This mimics the previous behavior and
222 // should over time change as the compositor starts to handle more cases. 222 // should over time change as the compositor starts to handle more cases.
223 std::unordered_set<uint32_t> prerolled_images_; 223 std::unordered_set<uint32_t> prerolled_images_;
224
225 ResourceFormat format_;
224 }; 226 };
225 227
226 } // namespace cc 228 } // namespace cc
227 229
228 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ 230 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/tiles/software_image_decode_controller.cc » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698