DeferredLayerUpdater: clean up Layer lifecycle

Test: refactoring CL, all existent tests should pass
bug:34919311
Change-Id: Ib2889667a5ab8a2aaba443458782bc163467f0ea
diff --git a/libs/hwui/GlLayer.cpp b/libs/hwui/GlLayer.cpp
index 8174bcc..aacad54 100644
--- a/libs/hwui/GlLayer.cpp
+++ b/libs/hwui/GlLayer.cpp
@@ -43,7 +43,10 @@
 }
 
 GlLayer::~GlLayer() {
-    if (texture.mId) {
+    // There's a rare possibility that Caches could have been destroyed already
+    // since this method is queued up as a task.
+    // Since this is a reset method, treat this as non-fatal.
+    if (caches.isInitialized() && texture.mId) {
         texture.deleteTexture();
     }
 }
@@ -64,15 +67,5 @@
     }
 }
 
-void GlLayer::clearTexture() {
-    // There's a rare possibility that Caches could have been destroyed already
-    // since this method is queued up as a task.
-    // Since this is a reset method, treat this as non-fatal.
-    if (caches.isInitialized()) {
-        caches.textureState().unbindTexture(texture.mId);
-    }
-    texture.mId = 0;
-}
-
 }; // namespace uirenderer
 }; // namespace android