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

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

Issue 2367953002: Implement OnMemoryStateChange for Various CC Classes (Closed)
Patch Set: Created 4 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
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_GPU_IMAGE_DECODE_CONTROLLER_H_ 5 #ifndef CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_
6 #define CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ 6 #define CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <vector> 10 #include <vector>
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // |persistent_cache_| represents the long-lived cache, keeping a certain 313 // |persistent_cache_| represents the long-lived cache, keeping a certain
314 // budget of ImageDatas alive even when their ref count reaches zero. 314 // budget of ImageDatas alive even when their ref count reaches zero.
315 using PersistentCache = base::MRUCache<uint32_t, scoped_refptr<ImageData>>; 315 using PersistentCache = base::MRUCache<uint32_t, scoped_refptr<ImageData>>;
316 PersistentCache persistent_cache_; 316 PersistentCache persistent_cache_;
317 317
318 // |in_use_cache_| represents the in-use (short-lived) cache. Entries are 318 // |in_use_cache_| represents the in-use (short-lived) cache. Entries are
319 // cleaned up as soon as their ref count reaches zero. 319 // cleaned up as soon as their ref count reaches zero.
320 using InUseCache = std::unordered_map<InUseCacheKey, InUseCacheEntry>; 320 using InUseCache = std::unordered_map<InUseCacheKey, InUseCacheEntry>;
321 InUseCache in_use_cache_; 321 InUseCache in_use_cache_;
322 322
323 size_t cached_items_limit_;
324 size_t cached_bytes_limit_;
325 size_t bytes_used_;
326 const size_t max_gpu_image_bytes_; 323 const size_t max_gpu_image_bytes_;
324 size_t cached_bytes_limit_ = max_gpu_image_bytes_;
325 size_t bytes_used_ = 0;
326 base::MemoryState memory_state_ = base::MemoryState::NORMAL;
327 327
328 // We can't release GPU backed SkImages without holding the context lock, 328 // We can't release GPU backed SkImages without holding the context lock,
329 // so we add them to this list and defer deletion until the next time the lock 329 // so we add them to this list and defer deletion until the next time the lock
330 // is held. 330 // is held.
331 std::vector<sk_sp<SkImage>> images_pending_deletion_; 331 std::vector<sk_sp<SkImage>> images_pending_deletion_;
332 }; 332 };
333 333
334 } // namespace cc 334 } // namespace cc
335 335
336 #endif // CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ 336 #endif // CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698