diff options
author | mtklein <mtklein@chromium.org> | 2016-02-21 13:36:50 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-21 13:36:50 -0800 |
commit | 03762fea75b0fe34ac0375407b83b6ae52e453b4 (patch) | |
tree | 81916dad8832c11247a1ed0686bfb210a9c113bd /tests/ImageFilterCacheTest.cpp | |
parent | 7c249e531900929c2fe2cdde76619fa6d2538c49 (diff) |
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
Diffstat (limited to 'tests/ImageFilterCacheTest.cpp')
-rw-r--r-- | tests/ImageFilterCacheTest.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp index 175d17c946..74c56df3ed 100644 --- a/tests/ImageFilterCacheTest.cpp +++ b/tests/ImageFilterCacheTest.cpp @@ -78,7 +78,7 @@ static void test_dont_find_if_diff_key(skiatest::Reporter* reporter, // Test purging when the max cache size is exceeded static void test_internal_purge(skiatest::Reporter* reporter, SkSpecialImage* image) { SkASSERT(image->getSize()); - static const size_t kCacheSize = image->getSize() + 10; + const size_t kCacheSize = image->getSize() + 10; SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kCacheSize)); SkIRect clip = SkIRect::MakeWH(100, 100); @@ -219,14 +219,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, context const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize); SkAutoTUnref<SkSpecialImage> fullImg(SkSpecialImage::NewFromGpu( - nullptr, full, + nullptr, full, kNeedNewImageUniqueID_SpecialImage, srcTexture)); const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); SkAutoTUnref<SkSpecialImage> subsetImg(SkSpecialImage::NewFromGpu( - nullptr, subset, + nullptr, subset, kNeedNewImageUniqueID_SpecialImage, srcTexture)); |