Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: skia/ext/fontmgr_default_win.cc

Issue 2644103003: Allow multiple calls to SetDefaultSkiaFactory on Windows. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/fontmgr_default_android.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/fontmgr_default_win.cc
diff --git a/skia/ext/fontmgr_default_win.cc b/skia/ext/fontmgr_default_win.cc
index 6c451fab3a4642831270ed34fd97a2efed2688ca..5e480d3cefabd2437b2e64b99da84f3764803da0 100644
--- a/skia/ext/fontmgr_default_win.cc
+++ b/skia/ext/fontmgr_default_win.cc
@@ -12,14 +12,22 @@ namespace {
// This is a leaky bare owning pointer.
SkFontMgr* g_default_fontmgr;
+// The ppapi code currently calls SetDefaultSkiaFactory twice on Win8+.
+// This tracks when the global escapes and shouldno longer be set.
+SkDEBUGCODE(bool g_factory_called;)
+
} // namespace
void SetDefaultSkiaFactory(sk_sp<SkFontMgr> fontmgr) {
- SkASSERT(g_default_fontmgr == nullptr);
+ SkASSERT(!g_factory_called);
+
+ SkSafeUnref(g_default_fontmgr);
g_default_fontmgr = fontmgr.release();
}
SK_API sk_sp<SkFontMgr> SkFontMgr::Factory() {
+ SkDEBUGCODE(g_factory_called = true;)
+
// This will be set when DirectWrite is in use, and an SkFontMgr has been
// created with the pre-sandbox warmed up one. Otherwise, we fallback to a
// GDI SkFontMgr which is used in the browser.
« no previous file with comments | « skia/ext/fontmgr_default_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698