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

Commit 0129f1a2 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

resolved conflicts for merge of b9783b49 to honeycomb-plus-aosp

Change-Id: I1d86ea56b3d1d1b69f6671e5b0df0ca3f0c79643
parents 58ac798e be939833
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -121,6 +121,13 @@ protected:
                            RefBase();
    virtual                 ~RefBase();

    // called when the last reference goes away. this is responsible for
    // calling the destructor. The default implementation just does
    // "delete this;".
    // Make sure to never acquire a strong reference from this function. The
    // same restrictions than for destructors apply.
    virtual void            destroy() const;

    //! Flags for extendObjectLifetime()
    enum {
        OBJECT_LIFETIME_WEAK    = 0x0001,
+9 −3
Original line number Diff line number Diff line
@@ -345,6 +345,10 @@ void RefBase::incStrong(const void* id) const
    const_cast<RefBase*>(this)->onFirstRef();
}

void RefBase::destroy() const {
    delete this;
}

void RefBase::decStrong(const void* id) const
{
    weakref_impl* const refs = mRefs;
@@ -357,7 +361,7 @@ void RefBase::decStrong(const void* id) const
    if (c == 1) {
        const_cast<RefBase*>(this)->onLastStrongRef(id);
        if ((refs->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK) {
            delete this;
            destroy();
        }
    }
    refs->decWeak(id);
@@ -415,7 +419,8 @@ void RefBase::weakref_type::decWeak(const void* id)
    
    if ((impl->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK) {
        if (impl->mStrong == INITIAL_STRONG_VALUE)
            delete impl->mBase;
            if (impl->mBase)
                impl->mBase->destroy();
        else {
            // LOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase);
            delete impl;
@@ -423,7 +428,8 @@ void RefBase::weakref_type::decWeak(const void* id)
    } else {
        impl->mBase->onLastWeakRef(id);
        if ((impl->mFlags&OBJECT_LIFETIME_FOREVER) != OBJECT_LIFETIME_FOREVER) {
            delete impl->mBase;
            if (impl->mBase)
                impl->mBase->destroy();
        }
    }
}
+4 −12
Original line number Diff line number Diff line
@@ -77,6 +77,10 @@ Layer::~Layer()
    }
}

void Layer::destroy() const {
    mFlinger->destroyLayer(this);
}

status_t Layer::setToken(const sp<UserClient>& userClient,
        SharedClient* sharedClient, int32_t token)
{
@@ -145,18 +149,6 @@ sp<LayerBaseClient::Surface> Layer::createSurface() const
    return sur;
}

status_t Layer::ditch()
{
    // NOTE: Called from the main UI thread

    // the layer is not on screen anymore. free as much resources as possible
    mFreezeLock.clear();

    Mutex::Autolock _l(mLock);
    mWidth = mHeight = 0;
    return NO_ERROR;
}

status_t Layer::setBuffers( uint32_t w, uint32_t h,
                            PixelFormat format, uint32_t flags)
{
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,6 @@ public:
    virtual bool isSecure() const           { return mSecure; }
    virtual bool isProtected() const;
    virtual sp<Surface> createSurface() const;
    virtual status_t ditch();
    virtual void onRemoved();

    // only for debugging
@@ -93,6 +92,7 @@ public:
        return mFreezeLock; }

protected:
    virtual void destroy() const;
    virtual void dump(String8& result, char* scratch, size_t size) const;

private:
+1 −4
Original line number Diff line number Diff line
@@ -616,10 +616,7 @@ LayerBaseClient::Surface::~Surface()
     */

    // destroy client resources
    sp<LayerBaseClient> layer = getOwner();
    if (layer != 0) {
        mFlinger->destroySurface(layer);
    }
    mFlinger->destroySurface(mOwner);
}

sp<LayerBaseClient> LayerBaseClient::Surface::getOwner() const {
Loading