Remove picture pre-allocation from SkPictureRecorder

This CL improves the separation of the SkPicture and SkPictureRecord classes. It delays creation of the SkPicture (in SkPictureRecorder) until recording is actually completed. To accomplish this the SkRecord-derived classes now get SkPathHeap and SkPictureContentInfo members that are absorbed by the SkPicture when it is constructed.

As an ancillary change, this CL also moves the SkPictureContentInfo object from SkPicture to SkPicturePlayback. This is intended to centralize all the data in the SkPicturePlayback object.

R=mtklein@google.com, reed@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/324293004
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index d6cdf05..b4920e3 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -15,6 +15,7 @@
 #endif
 #include "SkPathHeap.h"
 #include "SkPicture.h"
+#include "SkPicturePlayback.h"
 #include "SkPictureFlat.h"
 #include "SkTemplates.h"
 #include "SkWriter32.h"
@@ -33,7 +34,7 @@
 
 class SkPictureRecord : public SkCanvas {
 public:
-    SkPictureRecord(SkPicture* picture, const SkISize& dimensions, uint32_t recordFlags);
+    SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags);
     virtual ~SkPictureRecord();
 
     virtual void clear(SkColor) SK_OVERRIDE;
@@ -73,6 +74,28 @@
         return fPictureRefs;
     }
 
+    SkData* opData(bool deepCopy) const {
+        this->validate(fWriter.bytesWritten(), 0);
+
+        if (fWriter.bytesWritten() == 0) {
+            return SkData::NewEmpty();
+        }
+
+        if (deepCopy) {
+            return SkData::NewWithCopy(fWriter.contiguousArray(), fWriter.bytesWritten());
+        }
+
+        return fWriter.snapshotAsData();
+    }
+
+    SkPathHeap* pathHeap() {
+        return fPathHeap;
+    }
+
+    const SkPictureContentInfo& contentInfo() const {
+        return fContentInfo;
+    }
+
     void setFlags(uint32_t recordFlags) {
         fRecordFlags = recordFlags;
     }
@@ -283,12 +306,12 @@
     SkBitmapHeap* fBitmapHeap;
 
 private:
-    // The owning SkPicture
-    SkPicture* fPicture;
-
     friend class MatrixClipState; // for access to *Impl methods
     friend class SkMatrixClipStateMgr; // for access to *Impl methods
 
+    SkPictureContentInfo fContentInfo;
+    SkAutoTUnref<SkPathHeap> fPathHeap;
+
     SkChunkFlatController fFlattenableHeap;
 
     SkPaintDictionary fPaints;