Enable generating SkImage with the same uniqueID in SkImageGenerator subclass
authoraleksandar.stojiljkovic <aleksandar.stojiljkovic@intel.com>
Mon, 2 May 2016 08:43:38 +0000 (01:43 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 2 May 2016 08:43:38 +0000 (01:43 -0700)
commit95167758572eca33008dce3e8bebe2a7656a06c9
tree141aca09724a34015e59b40789d093459c92c30c
parent83906aedb919a0229b953a6f69624af90a035f7e
Enable generating SkImage with the same uniqueID in SkImageGenerator subclass

Enable reusing uniqueID when instantiating SkImageGenerator subclasses enables
using uniqueID in client code to cache generated bitmaps with no need to keep
the reference to SkImageGenerator.

This is a bug fix for out of memory cause in chromium and 100% CPU usage
described in issue 165750#13:
- cache uses SkImage::uniqueID() to cache decoded bitmaps.
- every animation loop creates new SkImage instances.
- after decoding, bitmap copies are added to cache, filling it up with
duplicates of previous loops frames.

BUG=165750

Blink patch that depends on this:
https://codereview.chromium.org/1925533003/
"High CPU and increased memory usage fix for high-res (GIF, WEBP...) animations."

Review-Url: https://codereview.chromium.org/1928403002
include/core/SkImageGenerator.h
src/core/SkImageGenerator.cpp