summaryrefslogtreecommitdiffstats
path: root/include/surfaceflinger
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-05-27 19:41:15 -0700
committerMathias Agopian <mathias@google.com>2010-05-27 19:55:43 -0700
commitc7b388c2b3a9558c85e3730a7c6b261392ce493e (patch)
tree38725561e04c5e754c0c3b2a240a507ea98f6cf4 /include/surfaceflinger
parentdf0364de6f7be68e003729c262fe2731b82ae10e (diff)
downloadframeworks_base-c7b388c2b3a9558c85e3730a7c6b261392ce493e.zip
frameworks_base-c7b388c2b3a9558c85e3730a7c6b261392ce493e.tar.gz
frameworks_base-c7b388c2b3a9558c85e3730a7c6b261392ce493e.tar.bz2
more clean-up of Surfaceflinger's client management
SurfaceComposerClient now only exist on the WindowManager side, the client side uses the new SurfaceClient class, which only exposes what a client needs. also instead of keeping mappings from IBinder to SurfaceComposerClients we have a SurfaceClient per Surface (referring to the same IBinder), this is made possible by the fact that SurfaceClient is very light. Change-Id: I6a1f7015424f07871632a25ed6a502c55abfcfa6
Diffstat (limited to 'include/surfaceflinger')
-rw-r--r--include/surfaceflinger/Surface.h3
-rw-r--r--include/surfaceflinger/SurfaceComposerClient.h43
2 files changed, 27 insertions, 19 deletions
diff --git a/include/surfaceflinger/Surface.h b/include/surfaceflinger/Surface.h
index e561fb9..33269cb 100644
--- a/include/surfaceflinger/Surface.h
+++ b/include/surfaceflinger/Surface.h
@@ -44,6 +44,7 @@ class Surface;
class SurfaceComposerClient;
class SharedClient;
class SharedBufferClient;
+class SurfaceClient;
// ---------------------------------------------------------------------------
@@ -263,7 +264,7 @@ private:
};
// constants
- sp<SurfaceComposerClient> mClient;
+ sp<SurfaceClient> mClient;
sp<ISurface> mSurface;
SurfaceID mToken;
uint32_t mIdentity;
diff --git a/include/surfaceflinger/SurfaceComposerClient.h b/include/surfaceflinger/SurfaceComposerClient.h
index 8396038..102aebc 100644
--- a/include/surfaceflinger/SurfaceComposerClient.h
+++ b/include/surfaceflinger/SurfaceComposerClient.h
@@ -40,7 +40,9 @@ class SharedClient;
class ISurfaceComposer;
class DisplayInfo;
-class SurfaceComposerClient : virtual public RefBase
+// ---------------------------------------------------------------------------
+
+class SurfaceComposerClient : public RefBase
{
public:
SurfaceComposerClient();
@@ -52,10 +54,6 @@ public:
// Return the connection of this client
sp<IBinder> connection() const;
- // Retrieve a client for an existing connection.
- static sp<SurfaceComposerClient>
- clientForConnection(const sp<IBinder>& conn);
-
// Forcibly remove connection before all references have gone away.
void dispose();
@@ -135,36 +133,45 @@ public:
status_t setMatrix(SurfaceID id, float dsdx, float dtdx, float dsdy, float dtdy);
status_t setPosition(SurfaceID id, int32_t x, int32_t y);
status_t setSize(SurfaceID id, uint32_t w, uint32_t h);
- void signalServer();
status_t destroySurface(SurfaceID sid);
- SharedClient* getSharedClient() const;
-
private:
- SurfaceComposerClient(const sp<ISurfaceComposer>& sm,
- const sp<IBinder>& conn);
-
- void init(const sp<ISurfaceComposer>& sm,
- const sp<ISurfaceFlingerClient>& conn);
-
+ virtual void onFirstRef();
inline layer_state_t* get_state_l(SurfaceID id);
layer_state_t* lockLayerState(SurfaceID id);
inline void unlockLayerState();
mutable Mutex mLock;
- layer_state_t* mPrebuiltLayerState;
SortedVector<layer_state_t> mStates;
int32_t mTransactionOpen;
+ layer_state_t* mPrebuiltLayerState;
// these don't need to be protected because they never change
// after assignment
status_t mStatus;
- SharedClient* mControl;
- sp<IMemoryHeap> mControlMemory;
sp<ISurfaceFlingerClient> mClient;
- sp<ISurfaceComposer> mSignalServer;
};
+// ---------------------------------------------------------------------------
+
+class SurfaceClient : public RefBase
+{
+ // all these attributes are constants
+ status_t mStatus;
+ SharedClient* mControl;
+ sp<IMemoryHeap> mControlMemory;
+ sp<IBinder> mConnection;
+ sp<ISurfaceComposer> mSignalServer;
+ void init(const sp<IBinder>& conn);
+public:
+ explicit SurfaceClient(const sp<IBinder>& conn);
+ explicit SurfaceClient(const sp<SurfaceComposerClient>& client);
+ status_t initCheck() const;
+ SharedClient* getSharedClient() const;
+ void signalServer() const;
+};
+
+// ---------------------------------------------------------------------------
}; // namespace android
#endif // ANDROID_SF_SURFACE_COMPOSER_CLIENT_H