diff options
author | junov <junov@chromium.org> | 2015-06-02 11:47:45 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-02 11:47:45 -0700 |
commit | d26c9fa66c45b5a050580772acfbcc1b5271543e (patch) | |
tree | 8704bc7f574c6300f57819e21613856c1bc75396 /src/pipe/SkGPipePriv.h | |
parent | a66cc7e1e01bab8590fdcfafb269e21bfe8782fa (diff) |
Fixing leaky handling of SkImage in SkDeferredCanvas.
Long lived SkImageHeap objects currently accumulate refs indefinitely.
This leads to massive memory leaks in the gpu-accelerated 2D canvas
code path. This CL does not implement a general fix for SkGPipe, but
it resolves the leak in SkDeferredCanvas (currently the only user
of SkGPipe) by resetting the image heap when the deferral queue is
flushed. This change also fixes the accounting of bytes allocated
by referenced images in order to trigger flushing heuristics
appropriately.
BUG=crbug.com/494148
Review URL: https://codereview.chromium.org/1145893007
Diffstat (limited to 'src/pipe/SkGPipePriv.h')
-rw-r--r-- | src/pipe/SkGPipePriv.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pipe/SkGPipePriv.h b/src/pipe/SkGPipePriv.h index c3919f635b..5f6e45b158 100644 --- a/src/pipe/SkGPipePriv.h +++ b/src/pipe/SkGPipePriv.h @@ -222,6 +222,8 @@ public: SkImageHeap(); virtual ~SkImageHeap(); + size_t bytesInCache() const { return fBytesInCache; } + void reset(); // slot must be "valid" -- 0 is never valid const SkImage* get(int32_t slot) const; // returns 0 if not found, else returns slot @@ -231,6 +233,7 @@ public: private: SkTDArray<const SkImage*> fArray; + size_t fBytesInCache; }; /////////////////////////////////////////////////////////////////////////////// |