diff options
author | 2018-12-11 12:07:25 -0800 | |
---|---|---|
committer | 2019-01-08 11:41:57 -0800 | |
commit | 6fb1a7e9627df030667304d88a3292f91e790ea9 (patch) | |
tree | 8b726ff0728f7813106cb6c02e5700da7b986065 /libs/gui/SurfaceControl.cpp | |
parent | abbbbd69c48056490c484a29af4aace65e5e7cf1 (diff) |
SurfaceFlinger: Remove removeLayer
We remove explicit layer destruction and replace it
with reparent->null, completing the transition to
a reference counted model.
Test: Manual
Bug: 62536731
Bug: 111373437
Bug: 111297488
Change-Id: I8ac7c5c5125e1c8daf84b42db00e1dd93a544bb5
Diffstat (limited to 'libs/gui/SurfaceControl.cpp')
-rw-r--r-- | libs/gui/SurfaceControl.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index b6ef286fd4..8e500a4f9b 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -63,7 +63,13 @@ SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) { SurfaceControl::~SurfaceControl() { - destroy(); + if (mClient != nullptr && mHandle != nullptr && mOwned) { + SurfaceComposerClient::doDropReferenceTransaction(mHandle, mClient->getClient()); + } + mClient.clear(); + mHandle.clear(); + mGraphicBufferProducer.clear(); + IPCThreadState::self()->flushCommands(); } void SurfaceControl::destroy() @@ -71,7 +77,7 @@ void SurfaceControl::destroy() // Avoid destroying the server-side surface if we are not the owner of it, meaning that we // retrieved it from another process. if (isValid() && mOwned) { - mClient->destroySurface(mHandle); + SurfaceComposerClient::Transaction().reparent(this, nullptr).apply(); } // clear all references and trigger an IPC now, to make sure things // happen without delay, since these resources are quite heavy. |