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

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

Issue 1839833003: Add medium image quality to software predecode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing. Created 4 years, 8 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 <memory> 10 #include <memory>
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // called with no lock acquired and it returns nullptr if the decoding or 222 // called with no lock acquired and it returns nullptr if the decoding or
223 // scaling failed. 223 // scaling failed.
224 std::unique_ptr<DecodedImage> GetScaledImageDecode(const ImageKey& key, 224 std::unique_ptr<DecodedImage> GetScaledImageDecode(const ImageKey& key,
225 const SkImage& image); 225 const SkImage& image);
226 226
227 void SanityCheckState(int line, bool lock_acquired); 227 void SanityCheckState(int line, bool lock_acquired);
228 void RefImage(const ImageKey& key); 228 void RefImage(const ImageKey& key);
229 void RefAtRasterImage(const ImageKey& key); 229 void RefAtRasterImage(const ImageKey& key);
230 void UnrefAtRasterImage(const ImageKey& key); 230 void UnrefAtRasterImage(const ImageKey& key);
231 231
232 // These functions indicate whether the images can be handled and cached by
233 // ImageDecodeController or whether they will fall through to Skia (with
234 // exception of possibly prerolling them). Over time these should return
235 // "false" in less cases, as the ImageDecodeController should start handling
236 // more of them.
237 bool CanHandleImage(const ImageKey& key);
238
239 // Helper function which dumps all images in a specific ImageMRUCache. 232 // Helper function which dumps all images in a specific ImageMRUCache.
240 void DumpImageMemoryForCache(const ImageMRUCache& cache, 233 void DumpImageMemoryForCache(const ImageMRUCache& cache,
241 const char* cache_name, 234 const char* cache_name,
242 base::trace_event::ProcessMemoryDump* pmd) const; 235 base::trace_event::ProcessMemoryDump* pmd) const;
243 236
244 std::unordered_map<ImageKey, scoped_refptr<ImageDecodeTask>, ImageKeyHash> 237 std::unordered_map<ImageKey, scoped_refptr<ImageDecodeTask>, ImageKeyHash>
245 pending_image_tasks_; 238 pending_image_tasks_;
246 239
247 // The members below this comment can only be accessed if the lock is held to 240 // The members below this comment can only be accessed if the lock is held to
248 // ensure that they are safe to access on multiple threads. 241 // ensure that they are safe to access on multiple threads.
249 base::Lock lock_; 242 base::Lock lock_;
250 243
251 // Decoded images and ref counts (predecode path). 244 // Decoded images and ref counts (predecode path).
252 ImageMRUCache decoded_images_; 245 ImageMRUCache decoded_images_;
253 std::unordered_map<ImageKey, int, ImageKeyHash> decoded_images_ref_counts_; 246 std::unordered_map<ImageKey, int, ImageKeyHash> decoded_images_ref_counts_;
254 247
255 // Decoded image and ref counts (at-raster decode path). 248 // Decoded image and ref counts (at-raster decode path).
256 ImageMRUCache at_raster_decoded_images_; 249 ImageMRUCache at_raster_decoded_images_;
257 std::unordered_map<ImageKey, int, ImageKeyHash> 250 std::unordered_map<ImageKey, int, ImageKeyHash>
258 at_raster_decoded_images_ref_counts_; 251 at_raster_decoded_images_ref_counts_;
259 252
260 MemoryBudget locked_images_budget_; 253 MemoryBudget locked_images_budget_;
261 254
262 // Note that this is used for cases where the only thing we do is preroll the 255 // Note that this is used for cases where the only thing we do is preroll the
263 // image the first time we see it. This mimics the previous behavior and 256 // image the first time we see it. This mimics the previous behavior and
264 // should over time change as the compositor starts to handle more cases. 257 // should over time change as the compositor starts to handle more cases.
265 std::unordered_set<uint32_t> prerolled_images_; 258 std::unordered_set<uint32_t> prerolled_images_;
vmpstr 2016/04/19 23:04:57 This can go as well.
cblume 2016/04/21 19:28:11 Done.
266 259
267 ResourceFormat format_; 260 ResourceFormat format_;
268 261
269 // Used to uniquely identify DecodedImages for memory traces. 262 // Used to uniquely identify DecodedImages for memory traces.
270 base::AtomicSequenceNumber next_tracing_id_; 263 base::AtomicSequenceNumber next_tracing_id_;
271 }; 264 };
272 265
273 } // namespace cc 266 } // namespace cc
274 267
275 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ 268 #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/tiles/software_image_decode_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698