Revert of Fix race condition in parallel font initialization. (https://codereview.chromium.org/355573006/)

Reason for revert:
breaks chrome builds

Original issue's description:
> Fix race condition in parallel font initialization.
>
> Uses a mutex to guard construction of the singleton, which initialies
> the non-threadsafe libfontconfig.  Without this change, the parallel
> path ops test runner crashes 6/10 and hangs 2/10 on startup; with this
> change, 0/10 problems.
>
> BUG=skia:2693
> R=mtklein@google.com,bungeman@google.com
>
> Committed: https://skia.googlesource.com/skia/+/df022f5972ae6a2a1d96d15c50eca52cade3abd8

R=mtklein@google.com, bungeman@google.com, reed@google.com, tomhudson@google.com, tomhudson@chromium.org
TBR=bungeman@google.com, mtklein@google.com, reed@google.com, tomhudson@chromium.org, tomhudson@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2693

Author: reed@chromium.org

Review URL: https://codereview.chromium.org/365503003
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h
index f548f37..8c12a56 100644
--- a/include/ports/SkFontConfigInterface.h
+++ b/include/ports/SkFontConfigInterface.h
@@ -14,8 +14,6 @@
 #include "SkTArray.h"
 #include "SkTypeface.h"
 
-struct SkBaseMutex;
-
 /**
  *  \class SkFontConfigInterface
  *
@@ -97,9 +95,8 @@
     /**
      *  Return a singleton instance of a direct subclass that calls into
      *  libfontconfig. This does not affect the refcnt of the returned instance.
-     *  The mutex may be used to guarantee the singleton is only constructed once.
      */
-    static SkFontConfigInterface* GetSingletonDirectInterface(SkBaseMutex* mutex);
+    static SkFontConfigInterface* GetSingletonDirectInterface();
 
     // New APIS, which have default impls for now (which do nothing)
 
diff --git a/src/ports/SkFontConfigInterface_android.cpp b/src/ports/SkFontConfigInterface_android.cpp
index 1f901b9..20e6c5e 100644
--- a/src/ports/SkFontConfigInterface_android.cpp
+++ b/src/ports/SkFontConfigInterface_android.cpp
@@ -155,8 +155,7 @@
     return gFontConfigInterface;
 }
 
-SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBaseMutex*) {
-    // Doesn't need passed-in mutex because getSingletonInterface() uses one
+SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface() {
     return getSingletonInterface();
 }
 
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp
index c0cfd8f..dc9afba 100644
--- a/src/ports/SkFontConfigInterface_direct.cpp
+++ b/src/ports/SkFontConfigInterface_direct.cpp
@@ -124,13 +124,9 @@
     SkMutex mutex_;
 };
 
-SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBaseMutex* mutex) {
-    SkAutoMutexAcquire ac(mutex);
-    static SkFontConfigInterfaceDirect* singleton = NULL;
-    if (singleton == NULL) {
-        singleton = SkNEW(SkFontConfigInterfaceDirect);
-    }
-    return singleton;
+SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface() {
+    SK_DECLARE_STATIC_LAZY_PTR(SkFontConfigInterfaceDirect, direct);
+    return direct.get();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp
index 8abf5cf..07bfbd0 100644
--- a/src/ports/SkFontHost_fontconfig.cpp
+++ b/src/ports/SkFontHost_fontconfig.cpp
@@ -50,7 +50,7 @@
         if (fci) {
             return fci;
         }
-        fci = SkFontConfigInterface::GetSingletonDirectInterface(&gFontConfigInterfaceMutex);
+        fci = SkFontConfigInterface::GetSingletonDirectInterface();
         SkFontConfigInterface::SetGlobal(fci);
     }
 }