Convert DisplayList to a value-type wrapper

Make DisplayList its own type instead of an alias,
pushing the Skia aspect behind it mostly. Removes a bunch
of manual memory management and opens the door to DisplayList
being a union type with multiple implementations

Test: builds (somehow), boots, hwuiunit passes, CtsUiRendering passes
Change-Id: I1d7806aa3afc5d9ece08b06959920078a5814c59
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h
index 1eaf0d4..39ea53b 100644
--- a/libs/hwui/RenderNode.h
+++ b/libs/hwui/RenderNode.h
@@ -100,17 +100,17 @@
     // See flags defined in DisplayList.java
     enum ReplayFlag { kReplayFlag_ClipChildren = 0x1 };
 
-    void setStagingDisplayList(DisplayList* newData);
+    void setStagingDisplayList(DisplayList&& newData);
     void discardStagingDisplayList();
 
     void output();
     int getUsageSize();
     int getAllocatedSize();
 
-    bool isRenderable() const { return mDisplayList && !mDisplayList->isEmpty(); }
+    bool isRenderable() const { return mDisplayList.hasContent(); }
 
     bool hasProjectionReceiver() const {
-        return mDisplayList && mDisplayList->containsProjectionReceiver();
+        return mDisplayList.containsProjectionReceiver();
     }
 
     const char* getName() const { return mName.string(); }
@@ -169,12 +169,14 @@
 
     bool nothingToDraw() const {
         const Outline& outline = properties().getOutline();
-        return mDisplayList == nullptr || properties().getAlpha() <= 0 ||
+        return !mDisplayList.isValid() || properties().getAlpha() <= 0 ||
                (outline.getShouldClip() && outline.isEmpty()) || properties().getScaleX() == 0 ||
                properties().getScaleY() == 0;
     }
 
-    const DisplayList* getDisplayList() const { return mDisplayList; }
+    const DisplayList& getDisplayList() const { return mDisplayList; }
+    // TODO: can this be cleaned up?
+    DisplayList& getDisplayList() { return mDisplayList; }
 
     // Note: The position callbacks are relying on the listener using
     // the frameNumber to appropriately batch/synchronize these transactions.
@@ -253,8 +255,8 @@
 
     bool mNeedsDisplayListSync;
     // WARNING: Do not delete this directly, you must go through deleteDisplayList()!
-    DisplayList* mDisplayList;
-    DisplayList* mStagingDisplayList;
+    DisplayList mDisplayList;
+    DisplayList mStagingDisplayList;
 
     int64_t mDamageGenerationId;