call portable font cleanup only once at app end
R=mtklein@google.com
Review URL: https://codereview.chromium.org/1180593005
diff --git a/tools/sk_tool_utils_font.cpp b/tools/sk_tool_utils_font.cpp
index 5cb65b2..925bd7d 100644
--- a/tools/sk_tool_utils_font.cpp
+++ b/tools/sk_tool_utils_font.cpp
@@ -20,17 +20,11 @@
#include "test_font_serif.cpp"
#include "test_font_index.cpp"
-static void release_portable_typefaces() {
- // We'll clean this up in our own tests, but disable for clients.
- // Chrome seems to have funky multi-process things going on in unit tests that
- // makes this unsafe to delete when the main process atexit()s.
- // SkLazyPtr does the same sort of thing.
-#if SK_DEVELOPER
+void release_portable_typefaces() {
for (int index = 0; index < gTestFontsCount; ++index) {
SkTestFontData& fontData = gTestFonts[index];
SkSafeUnref(fontData.fFontCache);
}
-#endif
}
SK_DECLARE_STATIC_MUTEX(gTestFontMutex);
@@ -69,7 +63,6 @@
SkDEBUGCODE(font->fDebugName = sub->fName);
SkDEBUGCODE(font->fDebugStyle = sub->fStyle);
fontData->fFontCache = SkSafeRef(font);
- atexit(release_portable_typefaces);
}
}
return SkNEW_ARGS(SkTestTypeface, (font, SkFontStyle(style)));