Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13127d89 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

Get rid of LayerBase.

The functionality of LayerBase and Layer is folded
into Layer. There wasn't a need for this abstraction
anymore.

Change-Id: I66511c08cc3d89009ba4deabf47e26cd4cfeaefb
parent 2f73af92
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@ LOCAL_SRC_FILES:= \
    EventThread.cpp                         \
    FrameTracker.cpp                        \
    Layer.cpp                               \
    LayerBase.cpp                           \
    LayerDim.cpp                            \
    DisplayHardware/FramebufferSurface.cpp  \
    DisplayHardware/HWComposer.cpp          \
+6 −7
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@

#include "Client.h"
#include "Layer.h"
#include "LayerBase.h"
#include "SurfaceFlinger.h"

namespace android {
@@ -43,7 +42,7 @@ Client::~Client()
{
    const size_t count = mLayers.size();
    for (size_t i=0 ; i<count ; i++) {
        sp<LayerBase> layer(mLayers.valueAt(i).promote());
        sp<Layer> layer(mLayers.valueAt(i).promote());
        if (layer != 0) {
            mFlinger->removeLayer(layer);
        }
@@ -54,13 +53,13 @@ status_t Client::initCheck() const {
    return NO_ERROR;
}

void Client::attachLayer(const sp<IBinder>& handle, const sp<LayerBase>& layer)
void Client::attachLayer(const sp<IBinder>& handle, const sp<Layer>& layer)
{
    Mutex::Autolock _l(mLock);
    mLayers.add(handle, layer);
}

void Client::detachLayer(const LayerBase* layer)
void Client::detachLayer(const Layer* layer)
{
    Mutex::Autolock _l(mLock);
    // we do a linear search here, because this doesn't happen often
@@ -72,11 +71,11 @@ void Client::detachLayer(const LayerBase* layer)
        }
    }
}
sp<LayerBase> Client::getLayerUser(const sp<IBinder>& handle) const
sp<Layer> Client::getLayerUser(const sp<IBinder>& handle) const
{
    Mutex::Autolock _l(mLock);
    sp<LayerBase> lbc;
    wp<LayerBase> layer(mLayers.valueFor(handle));
    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());
+5 −5
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ namespace android {

// ---------------------------------------------------------------------------

class LayerBase;
class Layer;
class SurfaceFlinger;

// ---------------------------------------------------------------------------
@@ -44,11 +44,11 @@ public:
    status_t initCheck() const;

    // protected by SurfaceFlinger::mStateLock
    void attachLayer(const sp<IBinder>& handle, const sp<LayerBase>& layer);
    void attachLayer(const sp<IBinder>& handle, const sp<Layer>& layer);

    void detachLayer(const LayerBase* layer);
    void detachLayer(const Layer* layer);

    sp<LayerBase> getLayerUser(const sp<IBinder>& handle) const;
    sp<Layer> getLayerUser(const sp<IBinder>& handle) const;

private:
    // ISurfaceComposerClient interface
@@ -66,7 +66,7 @@ private:
    sp<SurfaceFlinger> mFlinger;

    // protected by mLock
    DefaultKeyedVector< wp<IBinder>, wp<LayerBase> > mLayers;
    DefaultKeyedVector< wp<IBinder>, wp<Layer> > mLayers;

    // thread-safe
    mutable Mutex mLock;
+4 −4
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@
#include "DisplayDevice.h"
#include "GLExtensions.h"
#include "SurfaceFlinger.h"
#include "LayerBase.h"
#include "Layer.h"

// ----------------------------------------------------------------------------
using namespace android;
@@ -282,19 +282,19 @@ void DisplayDevice::setViewportAndProjection(const sp<const DisplayDevice>& hw)

// ----------------------------------------------------------------------------

void DisplayDevice::setVisibleLayersSortedByZ(const Vector< sp<LayerBase> >& layers) {
void DisplayDevice::setVisibleLayersSortedByZ(const Vector< sp<Layer> >& layers) {
    mVisibleLayersSortedByZ = layers;
    mSecureLayerVisible = false;
    size_t count = layers.size();
    for (size_t i=0 ; i<count ; i++) {
        const sp<LayerBase>& layer(layers[i]);
        const sp<Layer>& layer(layers[i]);
        if (layer->isSecure()) {
            mSecureLayerVisible = true;
        }
    }
}

const Vector< sp<LayerBase> >& DisplayDevice::getVisibleLayersSortedByZ() const {
const Vector< sp<Layer> >& DisplayDevice::getVisibleLayersSortedByZ() const {
    return mVisibleLayersSortedByZ;
}

+4 −4
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ namespace android {

class DisplayInfo;
class FramebufferSurface;
class LayerBase;
class Layer;
class SurfaceFlinger;
class HWComposer;

@@ -99,8 +99,8 @@ public:

    EGLSurface  getEGLSurface() const;

    void                    setVisibleLayersSortedByZ(const Vector< sp<LayerBase> >& layers);
    const Vector< sp<LayerBase> >& getVisibleLayersSortedByZ() const;
    void                    setVisibleLayersSortedByZ(const Vector< sp<Layer> >& layers);
    const Vector< sp<Layer> >& getVisibleLayersSortedByZ() const;
    bool                    getSecureLayerVisible() const;
    Region                  getDirtyRegion(bool repaintEverything) const;

@@ -186,7 +186,7 @@ private:
     */

    // list of visible layers on that display
    Vector< sp<LayerBase> > mVisibleLayersSortedByZ;
    Vector< sp<Layer> > mVisibleLayersSortedByZ;

    // Whether we have a visible secure layer on this display
    bool mSecureLayerVisible;
Loading