Fix SkOneShotDiscardablePixelRef to return discardable segment.
authorssid <ssid@chromium.org>
Fri, 4 Sep 2015 15:29:24 +0000 (08:29 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 4 Sep 2015 15:29:24 +0000 (08:29 -0700)
The SkOneShotDiscardablePixelRef was not overriding
diagnostic_only_getDiscardable method of SkPixelRef. This caused the
memory to be acocunted under malloc instead of discardable and caused
wrong accounting.

BUG=528295

Review URL: https://codereview.chromium.org/1304083006

src/core/SkResourceCache.cpp

index 7d3c342..46229fa 100644 (file)
@@ -87,6 +87,8 @@ protected:
     void onUnlockPixels() override;
     size_t getAllocatedSizeInBytes() const override;
 
+    SkDiscardableMemory* diagnostic_only_getDiscardable() const override { return fDM; }
+
 private:
     SkDiscardableMemory* fDM;
     size_t               fRB;