SK_ONCE for SkData and SkPathRef

Adds SK_ONCE_FRIEND, to allow SK_DEF_ONCE code to be friends with a class.  This had to go in include/core to be visible to headers there.

BUG=
R=reed@google.com, bungeman@google.com

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/26491003

git-svn-id: http://skia.googlecode.com/svn/trunk/include@11914 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkData.h b/core/SkData.h
index c244cb8..b5dc66f 100644
--- a/core/SkData.h
+++ b/core/SkData.h
@@ -136,6 +136,9 @@
     SkData(const void* ptr, size_t size, ReleaseProc, void* context);
     virtual ~SkData();
 
+    // Called the first time someone calls NewEmpty to initialize the singleton.
+    static void NewEmptyImpl(SkData**);
+
     typedef SkRefCnt INHERITED;
 };
 
diff --git a/core/SkPathRef.h b/core/SkPathRef.h
index 2228789..d832944 100644
--- a/core/SkPathRef.h
+++ b/core/SkPathRef.h
@@ -108,14 +108,7 @@
     /**
      * Gets a path ref with no verbs or points.
      */
-    static SkPathRef* CreateEmpty() {
-        static SkPathRef* gEmptyPathRef;
-        if (!gEmptyPathRef) {
-            gEmptyPathRef = SkNEW(SkPathRef); // leak!
-            gEmptyPathRef->computeBounds();   // Premptively avoid a race to clear fBoundsIsDirty.
-        }
-        return SkRef(gEmptyPathRef);
-    }
+    static SkPathRef* CreateEmpty();
 
     /**
      *  Returns true if all of the points in this path are finite, meaning there
@@ -397,6 +390,11 @@
 
     SkDEBUGCODE(void validate() const;)
 
+    /**
+     * Called the first time someone calls CreateEmpty to actually create the singleton.
+     */
+    static void CreateEmptyImpl(SkPathRef** empty);
+
     enum {
         kMinSize = 256,
     };