split surface management from surface's buffers management

Change-Id: If3c5655d1231f8f0c49ba68f972b1b20c93b3f87
diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h
index c9a516f..1a07f32 100644
--- a/libs/surfaceflinger/LayerBase.h
+++ b/libs/surfaceflinger/LayerBase.h
@@ -45,6 +45,7 @@
 class Client;
 class GraphicBuffer;
 class GraphicPlane;
+class LayerBaseClient;
 class SurfaceFlinger;
 class Texture;
 
@@ -100,6 +101,8 @@
 
             void invalidate();
 
+    virtual sp<LayerBaseClient> getLayerBaseClient() const { return 0; }
+
     virtual const char* getTypeId() const { return "LayerBase"; }
 
     /**
@@ -268,14 +271,14 @@
 public:
     class Surface;
 
-    const wp<Client> client;
-
             LayerBaseClient(SurfaceFlinger* flinger, DisplayID display,
                         const sp<Client>& client);
     virtual ~LayerBaseClient();
 
             sp<Surface> getSurface();
     virtual sp<Surface> createSurface() const;
+    virtual sp<LayerBaseClient> getLayerBaseClient() const {
+        return const_cast<LayerBaseClient*>(this); }
     virtual const char* getTypeId() const { return "LayerBaseClient"; }
 
     uint32_t getIdentity() const { return mIdentity; }
@@ -318,14 +321,10 @@
 private:
     mutable Mutex mLock;
     mutable wp<Surface> mClientSurface;
+    const wp<Client> mClientRef;
     // only read
     const uint32_t mIdentity;
     static int32_t sIdentity;
-
-    // TODO: get rid of this
-public:
-    virtual void setToken(int32_t token) { }
-    virtual int32_t getToken() const { return -1; }
 };
 
 // ---------------------------------------------------------------------------