diff options
| author | Mathias Agopian <mathias@google.com> | 2009-04-17 19:36:26 -0700 |
|---|---|---|
| committer | Mathias Agopian <mathias@google.com> | 2009-04-24 15:00:41 -0700 |
| commit | 6cf0db228ca275dfcda57d79c55e5fa306809632 (patch) | |
| tree | c1e57e8da8c8428bcac5afc877c16f472d0fb501 /libs/surfaceflinger/LayerBuffer.cpp | |
| parent | 2b1927f686eaec23a5798966b96aadaee3e2eb85 (diff) | |
| download | frameworks_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/LayerBuffer.cpp')
| -rw-r--r-- | libs/surfaceflinger/LayerBuffer.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp index f22ff59..97d6f97 100644 --- a/libs/surfaceflinger/LayerBuffer.cpp +++ b/libs/surfaceflinger/LayerBuffer.cpp @@ -50,10 +50,21 @@ LayerBuffer::~LayerBuffer() { } +void LayerBuffer::onFirstRef() +{ + mSurface = new SurfaceBuffer(mFlinger, clientIndex(), + const_cast<LayerBuffer *>(this)); +} + sp<LayerBaseClient::Surface> LayerBuffer::createSurface() const { - return new SurfaceBuffer(clientIndex(), - const_cast<LayerBuffer *>(this)); + return mSurface; +} + +status_t LayerBuffer::ditch() +{ + mSurface.clear(); + return NO_ERROR; } bool LayerBuffer::needsBlending() const { @@ -167,9 +178,9 @@ sp<LayerBuffer::Source> LayerBuffer::clearSource() { // LayerBuffer::SurfaceBuffer // ============================================================================ -LayerBuffer::SurfaceBuffer::SurfaceBuffer(SurfaceID id, - const sp<LayerBuffer>& owner) - : LayerBaseClient::Surface(id, owner->getIdentity(), owner) +LayerBuffer::SurfaceBuffer::SurfaceBuffer(const sp<SurfaceFlinger>& flinger, + SurfaceID id, const sp<LayerBuffer>& owner) + : LayerBaseClient::Surface(flinger, id, owner->getIdentity(), owner) { } |
