diff --git a/include/private/SkSLDefines.h b/include/private/SkSLDefines.h index cbf5511761..102506a40c 100644 --- a/include/private/SkSLDefines.h +++ b/include/private/SkSLDefines.h @@ -13,13 +13,6 @@ #include "include/core/SkTypes.h" #include "include/private/SkTArray.h" -#if defined(SK_BUILD_FOR_IOS) && \ - (!defined(__IPHONE_9_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0) -#define SKSL_USE_THREAD_LOCAL 0 -#else -#define SKSL_USE_THREAD_LOCAL 1 -#endif - using SKSL_INT = int64_t; using SKSL_FLOAT = float; diff --git a/modules/skottie/src/SkottieTool.cpp b/modules/skottie/src/SkottieTool.cpp index d37fcd1488..8b94094210 100644 --- a/modules/skottie/src/SkottieTool.cpp +++ b/modules/skottie/src/SkottieTool.cpp @@ -336,14 +336,6 @@ int main(int argc, char** argv) { i = frame_count - 1 - i; const auto start = std::chrono::steady_clock::now(); -#if defined(SK_BUILD_FOR_IOS) - // iOS doesn't support thread_local on versions less than 9.0. - auto anim = skottie::Animation::Builder() - .setResourceProvider(rp) - .setPrecompInterceptor(precomp_interceptor) - .make(static_cast(data->data()), data->size()); - auto sink = MakeSink(FLAGS_format[0], scale_matrix); -#else thread_local static auto* anim = skottie::Animation::Builder() .setResourceProvider(rp) @@ -351,7 +343,6 @@ int main(int argc, char** argv) { .make(static_cast(data->data()), data->size()) .release(); thread_local static auto* sink = MakeSink(FLAGS_format[0], scale_matrix).release(); -#endif if (sink && anim) { anim->seekFrame(frame0 + i * fps_scale); diff --git a/src/core/SkStrikeCache.cpp b/src/core/SkStrikeCache.cpp index 19a745412f..c8cc0ad317 100644 --- a/src/core/SkStrikeCache.cpp +++ b/src/core/SkStrikeCache.cpp @@ -21,12 +21,10 @@ bool gSkUseThreadLocalStrikeCaches_IAcknowledgeThisIsIncrediblyExperimental = false; SkStrikeCache* SkStrikeCache::GlobalStrikeCache() { -#if !defined(SK_BUILD_FOR_IOS) if (gSkUseThreadLocalStrikeCaches_IAcknowledgeThisIsIncrediblyExperimental) { static thread_local auto* cache = new SkStrikeCache; return cache; } -#endif static auto* cache = new SkStrikeCache; return cache; } diff --git a/src/core/SkVMBlitter.cpp b/src/core/SkVMBlitter.cpp index 3be35ee63e..a1e99961e3 100644 --- a/src/core/SkVMBlitter.cpp +++ b/src/core/SkVMBlitter.cpp @@ -579,14 +579,14 @@ SkVMBlitter::~SkVMBlitter() { } SkLRUCache* SkVMBlitter::TryAcquireProgramCache() { -#if 1 && defined(SKVM_JIT) +#if defined(SKVM_JIT) thread_local static SkLRUCache cache{64}; return &cache; #else - // iOS in particular does not support thread_local until iOS 9.0. - // On the other hand, we'll never be able to JIT there anyway. - // It's probably fine to not cache any interpreted programs, anywhere. - return nullptr; + // iOS now supports thread_local since iOS 9. + // On the other hand, we'll never be able to JIT there anyway. + // It's probably fine to not cache any interpreted programs, anywhere. + return nullptr; #endif } diff --git a/src/gpu/ops/AtlasTextOp.cpp b/src/gpu/ops/AtlasTextOp.cpp index 8286a69a49..980f9c50a0 100644 --- a/src/gpu/ops/AtlasTextOp.cpp +++ b/src/gpu/ops/AtlasTextOp.cpp @@ -33,7 +33,6 @@ namespace skgpu::v1 { // If we have thread local, then cache memory for a single AtlasTextOp. -#if defined(GR_HAS_THREAD_LOCAL) static thread_local void* gCache = nullptr; void* AtlasTextOp::operator new(size_t s) { if (gCache != nullptr) { @@ -55,7 +54,6 @@ void AtlasTextOp::ClearCache() { ::operator delete(gCache); gCache = nullptr; } -#endif AtlasTextOp::AtlasTextOp(MaskType maskType, bool needsTransform, diff --git a/src/gpu/ops/AtlasTextOp.h b/src/gpu/ops/AtlasTextOp.h index 83df60a114..5f9fc836e5 100644 --- a/src/gpu/ops/AtlasTextOp.h +++ b/src/gpu/ops/AtlasTextOp.h @@ -12,11 +12,6 @@ #include "src/gpu/ops/GrMeshDrawOp.h" #include "src/gpu/text/GrTextBlob.h" -#if !defined(SK_BUILD_FOR_IOS) || \ - (defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_9_0) - #define GR_HAS_THREAD_LOCAL -#endif - class GrRecordingContext; namespace skgpu::v1 { @@ -33,13 +28,9 @@ public: } } -#if defined(GR_HAS_THREAD_LOCAL) void* operator new(size_t s); void operator delete(void* b) noexcept; static void ClearCache(); -#else - static void ClearCache() {} -#endif static const int kVerticesPerGlyph = GrAtlasSubRun::kVerticesPerGlyph; static const int kIndicesPerGlyph = 6; diff --git a/src/sksl/SkSLPool.cpp b/src/sksl/SkSLPool.cpp index 60b4f7ea0f..b4d2b3f379 100644 --- a/src/sksl/SkSLPool.cpp +++ b/src/sksl/SkSLPool.cpp @@ -13,8 +13,6 @@ namespace SkSL { -#if SKSL_USE_THREAD_LOCAL - static thread_local MemoryPool* sMemPool = nullptr; static MemoryPool* get_thread_local_memory_pool() { @@ -25,32 +23,6 @@ static void set_thread_local_memory_pool(MemoryPool* memPool) { sMemPool = memPool; } -#else - -#include - -static pthread_key_t get_pthread_key() { - static pthread_key_t sKey = []{ - pthread_key_t key; - int result = pthread_key_create(&key, /*destructor=*/nullptr); - if (result != 0) { - SK_ABORT("pthread_key_create failure: %d", result); - } - return key; - }(); - return sKey; -} - -static MemoryPool* get_thread_local_memory_pool() { - return static_cast(pthread_getspecific(get_pthread_key())); -} - -static void set_thread_local_memory_pool(MemoryPool* poolData) { - pthread_setspecific(get_pthread_key(), poolData); -} - -#endif // SKSL_USE_THREAD_LOCAL - Pool::~Pool() { if (get_thread_local_memory_pool() == fMemPool.get()) { SkDEBUGFAIL("SkSL pool is being destroyed while it is still attached to the thread"); diff --git a/src/sksl/dsl/priv/DSLWriter.cpp b/src/sksl/dsl/priv/DSLWriter.cpp index 8312af7c6c..20de2118dc 100644 --- a/src/sksl/dsl/priv/DSLWriter.cpp +++ b/src/sksl/dsl/priv/DSLWriter.cpp @@ -25,10 +25,6 @@ #include "src/sksl/ir/SkSLPrefixExpression.h" #include "src/sksl/ir/SkSLSwitchStatement.h" -#if !SKSL_USE_THREAD_LOCAL -#include -#endif // !SKSL_USE_THREAD_LOCAL - namespace SkSL { namespace dsl { @@ -326,8 +322,6 @@ void DSLWriter::ReportErrors(PositionInfo pos) { GetErrorReporter().reportPendingErrors(pos); } -#if SKSL_USE_THREAD_LOCAL - thread_local DSLWriter* instance = nullptr; bool DSLWriter::IsActive() { @@ -345,40 +339,6 @@ void DSLWriter::SetInstance(std::unique_ptr newInstance) { instance = newInstance.release(); } -#else - -static void destroy_dslwriter(void* dslWriter) { - delete static_cast(dslWriter); -} - -static pthread_key_t get_pthread_key() { - static pthread_key_t sKey = []{ - pthread_key_t key; - int result = pthread_key_create(&key, destroy_dslwriter); - if (result != 0) { - SK_ABORT("pthread_key_create failure: %d", result); - } - return key; - }(); - return sKey; -} - -bool DSLWriter::IsActive() { - return pthread_getspecific(get_pthread_key()) != nullptr; -} - -DSLWriter& DSLWriter::Instance() { - DSLWriter* instance = static_cast(pthread_getspecific(get_pthread_key())); - SkASSERTF(instance, "dsl::Start() has not been called"); - return *instance; -} - -void DSLWriter::SetInstance(std::unique_ptr instance) { - delete static_cast(pthread_getspecific(get_pthread_key())); - pthread_setspecific(get_pthread_key(), instance.release()); -} -#endif - } // namespace dsl } // namespace SkSL