src/pdf: code cleanup

  * SkPDFCanon: remove unnecessary abstraction
  * Make use of SkTHashMap<K, sk_sp<T>>.
  * Remove unncessary struct constructors.
  * More factory fns return sk_sp<T>
  * SkPDFUtility::GetCachedT<T> factored out.

Change-Id: I4055a131b43fe2588fd042b769cd09fff8a3466c
Reviewed-on: https://skia-review.googlesource.com/13655
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/src/pdf/SkPDFGraphicState.h b/src/pdf/SkPDFGraphicState.h
index 8ee6728..310c1cf 100644
--- a/src/pdf/SkPDFGraphicState.h
+++ b/src/pdf/SkPDFGraphicState.h
@@ -33,15 +33,11 @@
     void emitObject(SkWStream* stream,
                     const SkPDFObjNumMap& objNumMap) const override;
 
-    /** Get the graphic state for the passed SkPaint. The reference count of
-     *  the object is incremented and it is the caller's responsibility to
-     *  unreference it when done. This is needed to accommodate the weak
-     *  reference pattern used when the returned object is new and has no
-     *  other references.
+    /** Get the graphic state for the passed SkPaint.
      *  @param paint  The SkPaint to emulate.
      */
-    static SkPDFGraphicState* GetGraphicStateForPaint(SkPDFCanon* canon,
-                                                      const SkPaint& paint);
+    static sk_sp<SkPDFGraphicState> GetGraphicStateForPaint(SkPDFCanon* canon,
+                                                            const SkPaint& paint);
 
     /** Make a graphic state that only sets the passed soft mask.
      *  @param sMask     The form xobject to use as a soft mask.