* Use unique_ptr, sk_sp, SkAutoFree, using.
* Rely on thread-safe static global initializion.
Change-Id: I7c14e0e57622163b1b81b97a218b816fe6d02926
Reviewed-on: https://skia-review.googlesource.com/13818
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
The Rec in the cache is the owner of the pixel memory
- discardable or
- malloc
Each external client has a pixelref that just points to those pixels,
and whose destructor will notify the rec.
This eliminates the dependency on lockPixels in pixelref, freeing us
to remove that entirely from pixelref.
Bug: skia:
Change-Id: If45ed0ae202a1211336626364235215253e8aa7c
Reviewed-on: https://skia-review.googlesource.com/10300
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This reverts commit 9f4b0ae91e.
Reason for revert: Nanobench asserts.
../../../src/core/SkBitmapCache.cpp:81: fatal error: "assert(scaledWidth != image->width() || scaledHeight != image->height())"
Aborted
Command exited with code 134
step returned non-zero exit code: 134
https://chromium-swarm.appspot.com/task?id=351b1d10c7936310&refresh=10
Original change's description:
> simplify api to bitmapcache
>
> Force all Find callers to make a bitmpacachedesc, which now
> has more rigid validation.
>
> Goal is to ensure we never make two desc (which turn into keys)
> that look different but represent the same image/transformation.
>
> BUG=skia:
>
> Change-Id: I8571837ee4754a69acc99e949bee9a465fa25f2b
> Reviewed-on: https://skia-review.googlesource.com/10114
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
>
TBR=brianosman@google.com,fmalita@chromium.org,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Change-Id: I21b3c8a5bae409ba740cfc28b352c3b970dcf5af
Reviewed-on: https://skia-review.googlesource.com/10171
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Force all Find callers to make a bitmpacachedesc, which now
has more rigid validation.
Goal is to ensure we never make two desc (which turn into keys)
that look different but represent the same image/transformation.
BUG=skia:
Change-Id: I8571837ee4754a69acc99e949bee9a465fa25f2b
Reviewed-on: https://skia-review.googlesource.com/10114
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
BUG=skia:
Change-Id: I01c5e1874c9a034febc64e25b3aaafb5050393a6
Reviewed-on: https://skia-review.googlesource.com/8021
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
This gives a picture image a preferred "native" color space, which
facilitates caching and other things.
BUG=skia:
Change-Id: I95988c14d17f96d7d870b3d1c3b723c36e2c170d
Reviewed-on: https://skia-review.googlesource.com/6158
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
This is much more explicit about what that type represents (are we in
legacy mode or not), which also makes it suitable for other (upcoming)
usage.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4529
Change-Id: Iacb397c34e7765f1ca86c0195bc622b2be4d9acf
Reviewed-on: https://skia-review.googlesource.com/4529
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Replace with std::unique_ptr.
Change-Id: I5806cfbb30515fcb20e5e66ce13fb5f3b8728176
Reviewed-on: https://skia-review.googlesource.com/4381
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Unit tests added to check all color types in SkOneShotDiscardablePixelref
SkResourceCacheTest seems to have been allways using default Heap Allocator.
Fixed so that it uses private (not global that is) SkDiscardableMemory.
BUG=skia:4355
Review URL: https://codereview.chromium.org/1426753006
This adds SkResourceCache::Remove() which will remove a resource from
its cache. The resource is required to be unlocked at the time Remove()
is called.
Then SkBitmapCache::Find() makes use of this to Remove() bitmaps from
the cache whose pixels have been evicted. This allows the bitmap to be
re-added to the cache with pixels again.
After this change, background a tab (and discarding all the bitmaps'
contents) no longer disables image caching for those discarded images
once the tab is visible again.
BUG=skia:2926
NOTRY=true
R=reed@android.com, tomhudson@google.com, reed@google.com
Author: danakj@chromium.org
Review URL: https://codereview.chromium.org/561953002