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 | 9a11206fe793363c0e8897b478cbe6ef8c52b543 (patch) | |
tree | 0b7fc29027a6803e1ab992f47f0dd66c2a3e3843 /libs/surfaceflinger/LayerBuffer.cpp | |
parent | 9f88afb013a7560bf1362d7999a4609e38d0ea77 (diff) | |
download | frameworks_native-9a11206fe793363c0e8897b478cbe6ef8c52b543.zip frameworks_native-9a11206fe793363c0e8897b478cbe6ef8c52b543.tar.gz frameworks_native-9a11206fe793363c0e8897b478cbe6ef8c52b543.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) { } |