summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/surfaceflinger/Client.cpp')
-rw-r--r--services/surfaceflinger/Client.cpp35
1 files changed, 3 insertions, 32 deletions
diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp
index 7202bef606..bdbc79b8e1 100644
--- a/services/surfaceflinger/Client.cpp
+++ b/services/surfaceflinger/Client.cpp
@@ -25,6 +25,7 @@
#include "Client.h"
#include "FrontEnd/LayerCreationArgs.h"
+#include "FrontEnd/LayerHandle.h"
#include "Layer.h"
#include "SurfaceFlinger.h"
@@ -47,36 +48,6 @@ status_t Client::initCheck() const {
return NO_ERROR;
}
-void Client::attachLayer(const sp<IBinder>& handle, const sp<Layer>& layer)
-{
- Mutex::Autolock _l(mLock);
- mLayers.add(handle, layer);
-}
-
-void Client::detachLayer(const Layer* layer)
-{
- Mutex::Autolock _l(mLock);
- // we do a linear search here, because this doesn't happen often
- const size_t count = mLayers.size();
- for (size_t i=0 ; i<count ; i++) {
- if (mLayers.valueAt(i) == layer) {
- mLayers.removeItemsAt(i, 1);
- break;
- }
- }
-}
-sp<Layer> Client::getLayerUser(const sp<IBinder>& handle) const
-{
- Mutex::Autolock _l(mLock);
- sp<Layer> lbc;
- wp<Layer> layer(mLayers.valueFor(handle));
- if (layer != 0) {
- lbc = layer.promote();
- ALOGE_IF(lbc==0, "getLayerUser(name=%p) is dead", handle.get());
- }
- return lbc;
-}
-
binder::Status Client::createSurface(const std::string& name, int32_t flags,
const sp<IBinder>& parent, const gui::LayerMetadata& metadata,
gui::CreateSurfaceResult* outResult) {
@@ -91,7 +62,7 @@ binder::Status Client::createSurface(const std::string& name, int32_t flags,
binder::Status Client::clearLayerFrameStats(const sp<IBinder>& handle) {
status_t status;
- sp<Layer> layer = getLayerUser(handle);
+ sp<Layer> layer = LayerHandle::getLayer(handle);
if (layer == nullptr) {
status = NAME_NOT_FOUND;
} else {
@@ -103,7 +74,7 @@ binder::Status Client::clearLayerFrameStats(const sp<IBinder>& handle) {
binder::Status Client::getLayerFrameStats(const sp<IBinder>& handle, gui::FrameStats* outStats) {
status_t status;
- sp<Layer> layer = getLayerUser(handle);
+ sp<Layer> layer = LayerHandle::getLayer(handle);
if (layer == nullptr) {
status = NAME_NOT_FOUND;
} else {