summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-04-17 19:36:26 -0700
committerMathias Agopian <mathias@google.com>2009-04-24 15:00:41 -0700
commit6cf0db228ca275dfcda57d79c55e5fa306809632 (patch)
treec1e57e8da8c8428bcac5afc877c16f472d0fb501 /libs/surfaceflinger/Layer.cpp
parent2b1927f686eaec23a5798966b96aadaee3e2eb85 (diff)
downloadframeworks_base-6cf0db228ca275dfcda57d79c55e5fa306809632.zip
frameworks_base-6cf0db228ca275dfcda57d79c55e5fa306809632.tar.gz
frameworks_base-6cf0db228ca275dfcda57d79c55e5fa306809632.tar.bz2
more Surface lifetime management
Surfaces are now destroyed once all references from the clients are gone, but they go through a partial destruction as soon as the window manager requests it. This last part is still buggy. see comments in SurfaceFlinger::destroySurface()
Diffstat (limited to 'libs/surfaceflinger/Layer.cpp')
-rw-r--r--libs/surfaceflinger/Layer.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index 980b78b..5fdec3f 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -87,6 +87,12 @@ sp<LayerBaseClient::Surface> Layer::createSurface() const
return mSurface;
}
+status_t Layer::ditch()
+{
+ mSurface.clear();
+ return NO_ERROR;
+}
+
status_t Layer::setBuffers( Client* client,
uint32_t w, uint32_t h,
PixelFormat format, uint32_t flags)
@@ -119,7 +125,7 @@ status_t Layer::setBuffers( Client* client,
return err;
}
}
- mSurface = new SurfaceLayer(clientIndex(), this);
+ mSurface = new SurfaceLayer(mFlinger, clientIndex(), this);
return NO_ERROR;
}
@@ -626,8 +632,13 @@ void Layer::finishPageFlip()
// ---------------------------------------------------------------------------
-Layer::SurfaceLayer::SurfaceLayer(SurfaceID id, const sp<Layer>& owner)
- : Surface(id, owner->getIdentity(), owner)
+Layer::SurfaceLayer::SurfaceLayer(const sp<SurfaceFlinger>& flinger,
+ SurfaceID id, const sp<Layer>& owner)
+ : Surface(flinger, id, owner->getIdentity(), owner)
+{
+}
+
+Layer::SurfaceLayer::~SurfaceLayer()
{
}