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

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

Issue 2382573002: Add BACKGROUND dump mode to various GPU/CC MemoryDumpProviders (Closed)
Patch Set: rebase 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
« no previous file with comments | « cc/tiles/gpu_image_decode_controller.cc ('k') | cc/tiles/software_image_decode_controller.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_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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // that we don't go over the limit when pre-decoding. 191 // that we don't go over the limit when pre-decoding.
192 class MemoryBudget { 192 class MemoryBudget {
193 public: 193 public:
194 explicit MemoryBudget(size_t limit_bytes); 194 explicit MemoryBudget(size_t limit_bytes);
195 195
196 size_t AvailableMemoryBytes() const; 196 size_t AvailableMemoryBytes() const;
197 void AddUsage(size_t usage); 197 void AddUsage(size_t usage);
198 void SubtractUsage(size_t usage); 198 void SubtractUsage(size_t usage);
199 void ResetUsage(); 199 void ResetUsage();
200 size_t total_limit_bytes() const { return limit_bytes_; } 200 size_t total_limit_bytes() const { return limit_bytes_; }
201 size_t GetCurrentUsageSafe() const;
201 202
202 private: 203 private:
203 size_t GetCurrentUsageSafe() const;
204
205 size_t limit_bytes_; 204 size_t limit_bytes_;
206 base::CheckedNumeric<size_t> current_usage_bytes_; 205 base::CheckedNumeric<size_t> current_usage_bytes_;
207 }; 206 };
208 207
209 using ImageMRUCache = base::HashingMRUCache<ImageKey, 208 using ImageMRUCache = base::HashingMRUCache<ImageKey,
210 std::unique_ptr<DecodedImage>, 209 std::unique_ptr<DecodedImage>,
211 ImageKeyHash>; 210 ImageKeyHash>;
212 211
213 // Looks for the key in the cache and returns true if it was found and was 212 // Looks for the key in the cache and returns true if it was found and was
214 // successfully locked (or if it was already locked). Note that if this 213 // successfully locked (or if it was already locked). Note that if this
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 ResourceFormat format_; 289 ResourceFormat format_;
291 size_t max_items_in_cache_; 290 size_t max_items_in_cache_;
292 291
293 // Used to uniquely identify DecodedImages for memory traces. 292 // Used to uniquely identify DecodedImages for memory traces.
294 base::AtomicSequenceNumber next_tracing_id_; 293 base::AtomicSequenceNumber next_tracing_id_;
295 }; 294 };
296 295
297 } // namespace cc 296 } // namespace cc
298 297
299 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ 298 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « cc/tiles/gpu_image_decode_controller.cc ('k') | cc/tiles/software_image_decode_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698