Home | History | Annotate | Download | only in ports
      1 /*
      2  * Copyright 2016 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #include "SkFontConfigInterface.h"
      9 #include "SkFontMgr.h"
     10 #include "SkMutex.h"
     11 #include "SkRefCnt.h"
     12 
     13 SK_DECLARE_STATIC_MUTEX(gFontConfigInterfaceMutex);
     14 static SkFontConfigInterface* gFontConfigInterface;
     15 
     16 SkFontConfigInterface* SkFontConfigInterface::RefGlobal() {
     17     SkAutoMutexAcquire ac(gFontConfigInterfaceMutex);
     18 
     19     if (gFontConfigInterface) {
     20         return SkRef(gFontConfigInterface);
     21     }
     22     return SkSafeRef(SkFontConfigInterface::GetSingletonDirectInterface());
     23 }
     24 
     25 SkFontConfigInterface* SkFontConfigInterface::SetGlobal(SkFontConfigInterface* fc) {
     26     SkAutoMutexAcquire ac(gFontConfigInterfaceMutex);
     27 
     28     SkRefCnt_SafeAssign(gFontConfigInterface, fc);
     29     return fc;
     30 }
     31