diff options
author | 2015-06-15 06:48:30 -0700 | |
---|---|---|
committer | 2015-06-15 06:48:30 -0700 | |
commit | f53ce808e9ff942c0bbc3c968e3d9393461c20db (patch) | |
tree | 309471d60c8229f2a625ef6a7fd39b6043327715 /tools | |
parent | 0bdb08b1ba8fbd18c4838f86a23f1ef4b3a3bfdf (diff) |
call portable font cleanup only once at app end
R=mtklein@google.com
Review URL: https://codereview.chromium.org/1180593005
Diffstat (limited to 'tools')
-rw-r--r-- | tools/sk_tool_utils.h | 2 | ||||
-rw-r--r-- | tools/sk_tool_utils_font.cpp | 9 |
2 files changed, 3 insertions, 8 deletions
diff --git a/tools/sk_tool_utils.h b/tools/sk_tool_utils.h index 4d4a5b4fcd..6730a89447 100644 --- a/tools/sk_tool_utils.h +++ b/tools/sk_tool_utils.h @@ -36,6 +36,8 @@ namespace sk_tool_utils { SkTypeface::Style style = SkTypeface::kNormal); SkTypeface* create_portable_typeface(const char* name, SkTypeface::Style style); SkTypeface* create_portable_typeface_always(const char* name, SkTypeface::Style style); + /** Call to clean up portable font references. */ + void release_portable_typefaces(); void report_used_chars(); /** diff --git a/tools/sk_tool_utils_font.cpp b/tools/sk_tool_utils_font.cpp index 5cb65b205c..925bd7dc76 100644 --- a/tools/sk_tool_utils_font.cpp +++ b/tools/sk_tool_utils_font.cpp @@ -20,17 +20,11 @@ namespace sk_tool_utils { #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 @@ SkTypeface* create_font(const char* name, SkTypeface::Style style) { 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))); |