fix race: this kCacheSize is probably not meant to be static
authormtklein <mtklein@chromium.org>
Sun, 21 Feb 2016 21:36:50 +0000 (13:36 -0800)
committerCommit bot <commit-bot@chromium.org>
Sun, 21 Feb 2016 21:36:50 +0000 (13:36 -0800)
commit03762fea75b0fe34ac0375407b83b6ae52e453b4
tree81916dad8832c11247a1ed0686bfb210a9c113bd
parent7c249e531900929c2fe2cdde76619fa6d2538c49
fix race: this kCacheSize is probably not meant to be static

TSAN sees us racing to intialize the static const kCacheSize.

This static const value depends on the runtime value image->getSize(), so there
is a race to set it.  I think this is unintentionally copy-paste from the other
tests that use a constant kCacheSize.  It's weird to intialize a constant based
on the first call to test_internal_purge(), though luckily we're always calling
it with same sized images today.

See these TSAN failures:
    https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN/builds/4937
    https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN/builds/4940/steps/dm/logs/stdio

TBR=robertphillips@google.com

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1720743002

Review URL: https://codereview.chromium.org/1720743002
tests/ImageFilterCacheTest.cpp