Cleanup DeferredLayerUpdater

Bug: 17765082

DeferredLayerUpdater had fallen behind RT updates. Re-snap to
latest expectations, ensuring to call requireGlContext() prior
to detachSurfaceTexture to avoid leaking SurfaceTextures

Change-Id: Ic65fb9831e5284f658866da8da9ad5af1d227699
diff --git a/libs/hwui/DeferredLayerUpdater.h b/libs/hwui/DeferredLayerUpdater.h
index c838c32..dda3e89 100644
--- a/libs/hwui/DeferredLayerUpdater.h
+++ b/libs/hwui/DeferredLayerUpdater.h
@@ -25,19 +25,18 @@
 #include "Layer.h"
 #include "Rect.h"
 #include "RenderNode.h"
+#include "renderthread/RenderThread.h"
 
 namespace android {
 namespace uirenderer {
 
-typedef void (*LayerDestroyer)(Layer* layer);
-
 // Container to hold the properties a layer should be set to at the start
 // of a render pass
 class DeferredLayerUpdater : public VirtualLightRefBase {
 public:
     // Note that DeferredLayerUpdater assumes it is taking ownership of the layer
     // and will not call incrementRef on it as a result.
-    ANDROID_API DeferredLayerUpdater(Layer* layer, LayerDestroyer = 0);
+    ANDROID_API DeferredLayerUpdater(renderthread::RenderThread& thread, Layer* layer);
     ANDROID_API ~DeferredLayerUpdater();
 
     ANDROID_API bool setSize(uint32_t width, uint32_t height) {
@@ -99,8 +98,7 @@
 
     Layer* mLayer;
     Caches& mCaches;
-
-    LayerDestroyer mDestroyer;
+    renderthread::RenderThread& mRenderThread;
 
     void doUpdateTexImage();
 };