diff options
Diffstat (limited to 'gfx/skia/skia/src/ports/SkFontConfigInterface.cpp')
-rw-r--r-- | gfx/skia/skia/src/ports/SkFontConfigInterface.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gfx/skia/skia/src/ports/SkFontConfigInterface.cpp b/gfx/skia/skia/src/ports/SkFontConfigInterface.cpp new file mode 100644 index 000000000..5b8731c3d --- /dev/null +++ b/gfx/skia/skia/src/ports/SkFontConfigInterface.cpp @@ -0,0 +1,30 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "SkFontConfigInterface.h" +#include "SkFontMgr.h" +#include "SkMutex.h" +#include "SkRefCnt.h" + +SK_DECLARE_STATIC_MUTEX(gFontConfigInterfaceMutex); +static SkFontConfigInterface* gFontConfigInterface; + +SkFontConfigInterface* SkFontConfigInterface::RefGlobal() { + SkAutoMutexAcquire ac(gFontConfigInterfaceMutex); + + if (gFontConfigInterface) { + return SkRef(gFontConfigInterface); + } + return SkSafeRef(SkFontConfigInterface::GetSingletonDirectInterface()); +} + +SkFontConfigInterface* SkFontConfigInterface::SetGlobal(SkFontConfigInterface* fc) { + SkAutoMutexAcquire ac(gFontConfigInterfaceMutex); + + SkRefCnt_SafeAssign(gFontConfigInterface, fc); + return fc; +} |