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

Unified Diff: src/ports/SkFontConfigInterface.cpp

Issue 2346333002: Split SkFontConfigInterface globals and factory. (Closed)
Patch Set: Created 4 years, 3 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
Index: src/ports/SkFontConfigInterface.cpp
diff --git a/src/ports/SkFontMgr_FontConfigInterface_factory.cpp b/src/ports/SkFontConfigInterface.cpp
similarity index 58%
copy from src/ports/SkFontMgr_FontConfigInterface_factory.cpp
copy to src/ports/SkFontConfigInterface.cpp
index 0ffc26116f9880a86bf8c6ba43400eef2c76cf49..5b8731c3d07cc9d8abd0fe94376954424b03cd2b 100644
--- a/src/ports/SkFontMgr_FontConfigInterface_factory.cpp
+++ b/src/ports/SkFontConfigInterface.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Google Inc.
+ * Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
@@ -16,7 +16,10 @@ static SkFontConfigInterface* gFontConfigInterface;
SkFontConfigInterface* SkFontConfigInterface::RefGlobal() {
SkAutoMutexAcquire ac(gFontConfigInterfaceMutex);
- return SkSafeRef(gFontConfigInterface);
+ if (gFontConfigInterface) {
+ return SkRef(gFontConfigInterface);
+ }
+ return SkSafeRef(SkFontConfigInterface::GetSingletonDirectInterface());
}
SkFontConfigInterface* SkFontConfigInterface::SetGlobal(SkFontConfigInterface* fc) {
@@ -25,20 +28,3 @@ SkFontConfigInterface* SkFontConfigInterface::SetGlobal(SkFontConfigInterface* f
SkRefCnt_SafeAssign(gFontConfigInterface, fc);
return fc;
}
-
-///////////////////////////////////////////////////////////////////////////////
-
-static SkFontConfigInterface* init_FCI() {
- SkAutoMutexAcquire ac(gFontConfigInterfaceMutex);
-
- if (gFontConfigInterface) {
- return SkRef(gFontConfigInterface);
- }
- gFontConfigInterface = SkRef(SkFontConfigInterface::GetSingletonDirectInterface());
- return gFontConfigInterface;
-}
-
-SkFontMgr* SkFontMgr::Factory() {
- SkFontConfigInterface* fci = init_FCI();
- return fci ? SkFontMgr_New_FCI(fci) : nullptr;
-}

Powered by Google App Engine
This is Rietveld 408576698