Refcount RenderNode

Change-Id: I7a86db8acc2b78ef33d987a43a119f5933d7d752
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index b428404..5375b45 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -19,6 +19,7 @@
 
 #include <cutils/compiler.h>
 #include <sys/types.h>
+#include <utils/StrongPointer.h>
 
 #include <GLES2/gl2.h>
 
@@ -85,13 +86,7 @@
     }
 
     void updateDeferred(RenderNode* displayList,
-            int left, int top, int right, int bottom) {
-        requireRenderer();
-        this->displayList = displayList;
-        const Rect r(left, top, right, bottom);
-        dirtyRect.unionWith(r);
-        deferredUpdateScheduled = true;
-    }
+            int left, int top, int right, int bottom);
 
     inline uint32_t getWidth() const {
         return texture.width;
@@ -294,7 +289,7 @@
      */
     bool deferredUpdateScheduled;
     OpenGLRenderer* renderer;
-    RenderNode* displayList;
+    sp<RenderNode> displayList;
     Rect dirtyRect;
     bool debugDrawUpdate;
     bool hasDrawnSinceUpdate;