Support HardwareLayers in RenderThread

 Also has a few HardwareLayer lifecycle fixes

Change-Id: I6308cb05f8f199eed72189ace768013a46815941
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 1ad0c2d..8ff3d63 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -21,15 +21,19 @@
 
 #include <cutils/compiler.h>
 #include <EGL/egl.h>
+#include <SkBitmap.h>
 #include <utils/Condition.h>
 #include <utils/Functor.h>
 #include <utils/Mutex.h>
 #include <utils/StrongPointer.h>
+#include <utils/Vector.h>
 
 namespace android {
 namespace uirenderer {
 
+class DeferredLayerUpdater;
 class DisplayList;
+class Layer;
 class Rect;
 
 namespace renderthread {
@@ -64,6 +68,11 @@
 
     ANDROID_API void runWithGlContext(RenderTask* task);
 
+    ANDROID_API DeferredLayerUpdater* createDisplayListLayer(int width, int height);
+    ANDROID_API DeferredLayerUpdater* createTextureLayer();
+    ANDROID_API bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap);
+    ANDROID_API void destroyLayer(DeferredLayerUpdater* layer);
+
 private:
     RenderThread& mRenderThread;
     CanvasContext* mContext;
@@ -71,6 +80,8 @@
     Mutex mSyncMutex;
     Condition mSyncCondition;
 
+    Vector<DeferredLayerUpdater*> mLayers;
+
     void destroyContext();
 
     MethodInvokeRenderTask* createTask(RunnableMethod method);