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

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

Issue 2795803002: Clear Image Decode Cache on Navigation (Closed)
Patch Set: fix conversion Created 3 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
« no previous file with comments | « cc/tiles/image_decode_cache.h ('k') | cc/tiles/software_image_decode_cache.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 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_CACHE_H_ 5 #ifndef CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_
6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ 6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 const DrawImage& image, 123 const DrawImage& image,
124 scoped_refptr<TileTask>* task) override; 124 scoped_refptr<TileTask>* task) override;
125 void UnrefImage(const DrawImage& image) override; 125 void UnrefImage(const DrawImage& image) override;
126 DecodedDrawImage GetDecodedImageForDraw(const DrawImage& image) override; 126 DecodedDrawImage GetDecodedImageForDraw(const DrawImage& image) override;
127 void DrawWithImageFinished(const DrawImage& image, 127 void DrawWithImageFinished(const DrawImage& image,
128 const DecodedDrawImage& decoded_image) override; 128 const DecodedDrawImage& decoded_image) override;
129 void ReduceCacheUsage() override; 129 void ReduceCacheUsage() override;
130 // Software doesn't keep outstanding images pinned, so this is a no-op. 130 // Software doesn't keep outstanding images pinned, so this is a no-op.
131 void SetShouldAggressivelyFreeResources( 131 void SetShouldAggressivelyFreeResources(
132 bool aggressively_free_resources) override {} 132 bool aggressively_free_resources) override {}
133 void ClearCache() override;
133 134
134 // Decode the given image and store it in the cache. This is only called by an 135 // Decode the given image and store it in the cache. This is only called by an
135 // image decode task from a worker thread. 136 // image decode task from a worker thread.
136 void DecodeImage(const ImageKey& key, 137 void DecodeImage(const ImageKey& key,
137 const DrawImage& image, 138 const DrawImage& image,
138 DecodeTaskType task_type); 139 DecodeTaskType task_type);
139 140
140 void RemovePendingTask(const ImageKey& key, DecodeTaskType task_type); 141 void RemovePendingTask(const ImageKey& key, DecodeTaskType task_type);
141 142
142 // MemoryDumpProvider overrides. 143 // MemoryDumpProvider overrides.
143 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 144 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
144 base::trace_event::ProcessMemoryDump* pmd) override; 145 base::trace_event::ProcessMemoryDump* pmd) override;
145 146
147 size_t GetNumCacheEntriesForTesting() const { return decoded_images_.size(); }
148
146 private: 149 private:
147 // DecodedImage is a convenience storage for discardable memory. It can also 150 // DecodedImage is a convenience storage for discardable memory. It can also
148 // construct an image out of SkImageInfo and stored discardable memory. 151 // construct an image out of SkImageInfo and stored discardable memory.
149 class DecodedImage { 152 class DecodedImage {
150 public: 153 public:
151 DecodedImage(const SkImageInfo& info, 154 DecodedImage(const SkImageInfo& info,
152 std::unique_ptr<base::DiscardableMemory> memory, 155 std::unique_ptr<base::DiscardableMemory> memory,
153 const SkSize& src_rect_offset, 156 const SkSize& src_rect_offset,
154 uint64_t tracing_id); 157 uint64_t tracing_id);
155 ~DecodedImage(); 158 ~DecodedImage();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 ResourceFormat format_; 312 ResourceFormat format_;
310 size_t max_items_in_cache_; 313 size_t max_items_in_cache_;
311 314
312 // Used to uniquely identify DecodedImages for memory traces. 315 // Used to uniquely identify DecodedImages for memory traces.
313 base::AtomicSequenceNumber next_tracing_id_; 316 base::AtomicSequenceNumber next_tracing_id_;
314 }; 317 };
315 318
316 } // namespace cc 319 } // namespace cc
317 320
318 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ 321 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_
OLDNEW
« no previous file with comments | « cc/tiles/image_decode_cache.h ('k') | cc/tiles/software_image_decode_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698