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

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

Issue 1869753003: Replace many skia::RefPtr with sk_sp<> in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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>
11 #include <unordered_map> 11 #include <unordered_map>
12 #include <unordered_set> 12 #include <unordered_set>
13 13
14 #include "base/atomic_sequence_num.h" 14 #include "base/atomic_sequence_num.h"
15 #include "base/containers/mru_cache.h" 15 #include "base/containers/mru_cache.h"
16 #include "base/hash.h" 16 #include "base/hash.h"
17 #include "base/memory/discardable_memory_allocator.h" 17 #include "base/memory/discardable_memory_allocator.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/numerics/safe_math.h" 19 #include "base/numerics/safe_math.h"
20 #include "base/threading/thread_checker.h" 20 #include "base/threading/thread_checker.h"
21 #include "base/trace_event/memory_dump_provider.h" 21 #include "base/trace_event/memory_dump_provider.h"
22 #include "cc/base/cc_export.h" 22 #include "cc/base/cc_export.h"
23 #include "cc/playback/decoded_draw_image.h" 23 #include "cc/playback/decoded_draw_image.h"
24 #include "cc/playback/draw_image.h" 24 #include "cc/playback/draw_image.h"
25 #include "cc/raster/tile_task_runner.h" 25 #include "cc/raster/tile_task_runner.h"
26 #include "cc/tiles/image_decode_controller.h" 26 #include "cc/tiles/image_decode_controller.h"
27 #include "skia/ext/refptr.h" 27 #include "third_party/skia/include/core/SkRefCnt.h"
28 28
29 namespace cc { 29 namespace cc {
30 30
31 // ImageDecodeControllerKey is a class that gets a cache key out of a given draw 31 // ImageDecodeControllerKey is a class that gets a cache key out of a given draw
32 // image. That is, this key uniquely identifies an image in the cache. Note that 32 // image. That is, this key uniquely identifies an image in the cache. Note that
33 // it's insufficient to use SkImage's unique id, since the same image can appear 33 // it's insufficient to use SkImage's unique id, since the same image can appear
34 // in the cache multiple times at different scales and filter qualities. 34 // in the cache multiple times at different scales and filter qualities.
35 class CC_EXPORT ImageDecodeControllerKey { 35 class CC_EXPORT ImageDecodeControllerKey {
36 public: 36 public:
37 static ImageDecodeControllerKey FromDrawImage(const DrawImage& image); 37 static ImageDecodeControllerKey FromDrawImage(const DrawImage& image);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 const base::DiscardableMemory* memory() const { return memory_.get(); } 155 const base::DiscardableMemory* memory() const { return memory_.get(); }
156 156
157 // An ID which uniquely identifies this DecodedImage within the image decode 157 // An ID which uniquely identifies this DecodedImage within the image decode
158 // controller. Used in memory tracing. 158 // controller. Used in memory tracing.
159 uint64_t tracing_id() const { return tracing_id_; } 159 uint64_t tracing_id() const { return tracing_id_; }
160 160
161 private: 161 private:
162 bool locked_; 162 bool locked_;
163 SkImageInfo image_info_; 163 SkImageInfo image_info_;
164 std::unique_ptr<base::DiscardableMemory> memory_; 164 std::unique_ptr<base::DiscardableMemory> memory_;
165 skia::RefPtr<SkImage> image_; 165 sk_sp<SkImage> image_;
166 SkSize src_rect_offset_; 166 SkSize src_rect_offset_;
167 uint64_t tracing_id_; 167 uint64_t tracing_id_;
168 }; 168 };
169 169
170 // MemoryBudget is a convenience class for memory bookkeeping and ensuring 170 // MemoryBudget is a convenience class for memory bookkeeping and ensuring
171 // that we don't go over the limit when pre-decoding. 171 // that we don't go over the limit when pre-decoding.
172 class MemoryBudget { 172 class MemoryBudget {
173 public: 173 public:
174 explicit MemoryBudget(size_t limit_bytes); 174 explicit MemoryBudget(size_t limit_bytes);
175 175
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 ResourceFormat format_; 254 ResourceFormat format_;
255 255
256 // Used to uniquely identify DecodedImages for memory traces. 256 // Used to uniquely identify DecodedImages for memory traces.
257 base::AtomicSequenceNumber next_tracing_id_; 257 base::AtomicSequenceNumber next_tracing_id_;
258 }; 258 };
259 259
260 } // namespace cc 260 } // namespace cc
261 261
262 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ 262 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698