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

Side by Side Diff: src/pipe/SkGPipePriv.h

Issue 1145893007: Fixing leaky handling of SkImage in SkDeferredCanvas. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: reed feedback Created 5 years, 6 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 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 static inline bool shouldFlattenBitmaps(uint32_t flags) { 215 static inline bool shouldFlattenBitmaps(uint32_t flags) {
216 return SkToBool(flags & SkGPipeWriter::kCrossProcess_Flag 216 return SkToBool(flags & SkGPipeWriter::kCrossProcess_Flag
217 && !(flags & SkGPipeWriter::kSharedAddressSpace_Flag)); 217 && !(flags & SkGPipeWriter::kSharedAddressSpace_Flag));
218 } 218 }
219 219
220 class SkImageHeap : public SkRefCnt { 220 class SkImageHeap : public SkRefCnt {
221 public: 221 public:
222 SkImageHeap(); 222 SkImageHeap();
223 virtual ~SkImageHeap(); 223 virtual ~SkImageHeap();
224 224
225 size_t bytesInCache() const { return fBytesInCache; }
226 void reset();
225 // slot must be "valid" -- 0 is never valid 227 // slot must be "valid" -- 0 is never valid
226 const SkImage* get(int32_t slot) const; 228 const SkImage* get(int32_t slot) const;
227 // returns 0 if not found, else returns slot 229 // returns 0 if not found, else returns slot
228 int32_t find(const SkImage*) const; 230 int32_t find(const SkImage*) const;
229 // returns non-zero value for where the image was stored 231 // returns non-zero value for where the image was stored
230 int32_t insert(const SkImage*); 232 int32_t insert(const SkImage*);
231 233
232 private: 234 private:
233 SkTDArray<const SkImage*> fArray; 235 SkTDArray<const SkImage*> fArray;
236 size_t fBytesInCache;
234 }; 237 };
235 238
236 /////////////////////////////////////////////////////////////////////////////// 239 ///////////////////////////////////////////////////////////////////////////////
237 240
238 enum PaintOps { 241 enum PaintOps {
239 kReset_PaintOp, // no arg 242 kReset_PaintOp, // no arg
240 243
241 kFlags_PaintOp, // arg inline 244 kFlags_PaintOp, // arg inline
242 kColor_PaintOp, // arg 32 245 kColor_PaintOp, // arg 32
243 kFilterLevel_PaintOp, // arg inline 246 kFilterLevel_PaintOp, // arg inline
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 SkASSERT(0 == (op & ~PAINTOPS_OP_MASK)); 298 SkASSERT(0 == (op & ~PAINTOPS_OP_MASK));
296 SkASSERT(0 == (flags & ~PAINTOPS_FLAG_MASK)); 299 SkASSERT(0 == (flags & ~PAINTOPS_FLAG_MASK));
297 SkASSERT(0 == (data & ~PAINTOPS_DATA_MASK)); 300 SkASSERT(0 == (data & ~PAINTOPS_DATA_MASK));
298 301
299 return (op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS)) | 302 return (op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS)) |
300 (flags << PAINTOPS_DATA_BITS) | 303 (flags << PAINTOPS_DATA_BITS) |
301 data; 304 data;
302 } 305 }
303 306
304 #endif 307 #endif
OLDNEW
« no previous file with comments | « include/pipe/SkGPipe.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | src/pipe/SkGPipeWrite.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698