Use officially supported compile time thread local strike cache flag. (#191014)
With https://skia-review.git.corp.google.com/c/skia/+/1321976 landing,
we have a more officially supported way to opt into thread local strike
caches.
diff --git a/engine/src/flutter/skia/BUILD.gn b/engine/src/flutter/skia/BUILD.gn
index 99b69b8..b20346b 100644
--- a/engine/src/flutter/skia/BUILD.gn
+++ b/engine/src/flutter/skia/BUILD.gn
@@ -69,6 +69,10 @@
defines += [ "SK_USE_PERFETTO" ]
}
+ if (skia_enable_threadlocal_strikecache) {
+ defines += [ "SK_ENABLE_THREADLOCAL_STRIKECACHE" ]
+ }
+
# Some older versions of the Clang toolchain change the visibility of
# symbols decorated with API_AVAILABLE macro to be visible. Users of such
# toolchains suppress the use of this macro till toolchain updates are made.
diff --git a/engine/src/flutter/skwasm/surface.cc b/engine/src/flutter/skwasm/surface.cc
index 65f6d9d..11fcf1d 100644
--- a/engine/src/flutter/skwasm/surface.cc
+++ b/engine/src/flutter/skwasm/surface.cc
@@ -41,16 +41,6 @@
// the Dart code, which will complete the future that was returned by the
// original Dart method call.
-// See https://github.com/flutter/flutter/pull/190048
-extern bool
- gSkUseThreadLocalStrikeCaches_IAcknowledgeThisIsIncrediblyExperimental;
-
-namespace {
-__attribute__((constructor)) void UseThreadLocalStrikeCaches() {
- gSkUseThreadLocalStrikeCaches_IAcknowledgeThisIsIncrediblyExperimental = true;
-}
-} // namespace
-
unsigned long Skwasm::GetRasterThread() {
static unsigned long thread = []() {
if (skwasm_isSingleThreaded()) {
diff --git a/engine/src/flutter/third_party/canvaskit/BUILD.gn b/engine/src/flutter/third_party/canvaskit/BUILD.gn
index 92536dd..84952e6 100644
--- a/engine/src/flutter/third_party/canvaskit/BUILD.gn
+++ b/engine/src/flutter/third_party/canvaskit/BUILD.gn
@@ -138,6 +138,9 @@
skia_use_no_png_encode = true
skia_use_libpng_encode = false
+ # Always use thread local strike caches, since we use workers for multithreading
+ skia_enable_threadlocal_strikecache = true
+
# skwasm is multithreaded
wasm_use_workers = true
wasm_prioritize_size = true