summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-08-11 18:18:50 -0700
committerMathias Agopian <mathias@google.com>2011-08-11 22:33:02 -0700
commit91b539801833012798b1998c30440136add7e7d4 (patch)
tree737ec453d22c309e022fbe9a1506847d9dec0ecd /services/surfaceflinger/Layer.cpp
parent0642fed2a226c2ccc85ca1058bb875d3077a41ef (diff)
downloadframeworks_base-91b539801833012798b1998c30440136add7e7d4.zip
frameworks_base-91b539801833012798b1998c30440136add7e7d4.tar.gz
frameworks_base-91b539801833012798b1998c30440136add7e7d4.tar.bz2
SurfaceFlinger doesn't rely on having a custom RefBase destructor
we just use a message to the main thread to destroy our GLES state.
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 505c843..55b354d 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -65,14 +65,9 @@ Layer::Layer(SurfaceFlinger* flinger,
glGenTextures(1, &mTextureName);
}
-void Layer::destroy(RefBase const* base) {
- mFlinger->destroyLayer(static_cast<LayerBase const*>(base));
-}
-
void Layer::onFirstRef()
{
LayerBaseClient::onFirstRef();
- setDestroyer(this);
struct FrameQueuedListener : public SurfaceTexture::FrameAvailableListener {
FrameQueuedListener(Layer* layer) : mLayer(layer) { }
@@ -93,7 +88,16 @@ void Layer::onFirstRef()
Layer::~Layer()
{
- glDeleteTextures(1, &mTextureName);
+ class MessageDestroyGLState : public MessageBase {
+ GLuint texture;
+ public:
+ MessageDestroyGLState(GLuint texture) : texture(texture) { }
+ virtual bool handler() {
+ glDeleteTextures(1, &texture);
+ return true;
+ }
+ };
+ mFlinger->postMessageAsync( new MessageDestroyGLState(mTextureName) );
}
void Layer::onFrameQueued() {