diff --git a/gn/tests.gni b/gn/tests.gni index 0c34a6cfd3..cde4e1a937 100644 --- a/gn/tests.gni +++ b/gn/tests.gni @@ -262,7 +262,6 @@ tests_sources = [ "$_tests/TextBlobTest.cpp", "$_tests/TextureProxyTest.cpp", "$_tests/Time.cpp", - "$_tests/TLSTest.cpp", "$_tests/TopoSortTest.cpp", "$_tests/ToSRGBColorFilter.cpp", "$_tests/TraceMemoryDumpTest.cpp", diff --git a/include/core/SkGraphics.h b/include/core/SkGraphics.h index 1c97f0c291..98307683e8 100644 --- a/include/core/SkGraphics.h +++ b/include/core/SkGraphics.h @@ -161,26 +161,6 @@ public: */ static void SetFlags(const char* flags); - /** - * Return the max number of bytes that should be used by the thread-local - * font cache. - * If the cache needs to allocate more, it will purge previous entries. - * This max can be changed by calling SetFontCacheLimit(). - * - * If this thread has never called SetTLSFontCacheLimit, or has called it - * with 0, then this thread is using the shared font cache. In that case, - * this function will always return 0, and the caller may want to call - * GetFontCacheLimit. - */ - static size_t GetTLSFontCacheLimit(); - - /** - * Specify the max number of bytes that should be used by the thread-local - * font cache. If this value is 0, then this thread will use the shared - * global font cache. - */ - static void SetTLSFontCacheLimit(size_t bytes); - typedef std::unique_ptr (*ImageGeneratorFromEncodedDataFactory)(sk_sp); diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index f16de64ea3..99afad3dd2 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -799,10 +799,6 @@ void SkGraphics::PurgeFontCache() { SkTypefaceCache::PurgeAll(); } -// TODO(herb): clean up TLS apis. -size_t SkGraphics::GetTLSFontCacheLimit() { return 0; } -void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { } - SkGlyphCache* SkGlyphCache::DetachCache( SkTypeface* typeface, const SkScalerContextEffects& effects, const SkDescriptor* desc) { diff --git a/tests/PathOpsThreadedCommon.h b/tests/PathOpsThreadedCommon.h index 706da6b110..b47af531ad 100644 --- a/tests/PathOpsThreadedCommon.h +++ b/tests/PathOpsThreadedCommon.h @@ -83,7 +83,6 @@ public: void operator()() { SkBitmap bitmap; fState.fBitmap = &bitmap; - SkGraphics::SetTLSFontCacheLimit(1 * 1024 * 1024); (*fTestFun)(&fState); } diff --git a/tests/TLSTest.cpp b/tests/TLSTest.cpp deleted file mode 100644 index 0fadd7ed9c..0000000000 --- a/tests/TLSTest.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkGraphics.h" -#include "SkPaint.h" -#include "SkTLS.h" -#include "Test.h" -#include -#include - -static void thread_main() { - SkGraphics::SetTLSFontCacheLimit(1 * 1024 * 1024); - - const char text[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - size_t len = strlen(text); - - SkPaint paint; - - for (int j = 0; j < 10; ++j) { - for (int i = 9; i <= 48; ++i) { - paint.setTextSize(SkIntToScalar(i)); - paint.setAntiAlias(false); - paint.measureText(text, len); - paint.setAntiAlias(true); - paint.measureText(text, len); - } - } -} - -template -static void test_threads(Fn fn) { - std::thread threads[8]; - - for (auto& thread : threads) { - thread = std::thread(fn); - } - for (auto& thread : threads) { - thread.join(); - } -} - -static std::atomic gCounter{0}; - -static void* fake_create_TLS() { - gCounter++; - return nullptr; -} -static void fake_delete_TLS(void*) { - gCounter--; -} - -DEF_TEST(TLS, reporter) { - // TODO: Disabled for now to work around - // http://code.google.com/p/skia/issues/detail?id=619 - // ('flaky segfault in TLS test on Shuttle_Ubuntu12 buildbots') - if( false ) test_threads(&thread_main); - - // Test to ensure that at thread destruction, TLS destructors - // have been called. - test_threads([] { - SkTLS::Get(fake_create_TLS, fake_delete_TLS); - }); - REPORTER_ASSERT(reporter, 0 == gCounter.load()); -}