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

Commit 8d949dea authored by Melody Hsu's avatar Melody Hsu Committed by Android (Google) Code Review
Browse files

Merge "Fulfill hanging promises upon LayerFE destruction" into main

parents 5441005c 5aeb8160
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@

#include "LayerFE.h"
#include "SurfaceFlinger.h"
#include "common/FlagManager.h"
#include "ui/FenceResult.h"
#include "ui/LayerStack.h"

@@ -80,6 +81,16 @@ void getDrawingTransformMatrix(const std::shared_ptr<renderengine::ExternalTextu

LayerFE::LayerFE(const std::string& name) : mName(name) {}

LayerFE::~LayerFE() {
    // Ensures that no promise is left unfulfilled before the LayerFE is destroyed.
    // An unfulfilled promise could occur when a screenshot is attempted, but the
    // render area is invalid and there is no memory for the capture result.
    if (FlagManager::getInstance().ce_fence_promise() &&
        mReleaseFencePromiseStatus == ReleaseFencePromiseStatus::INITIALIZED) {
        setReleaseFence(Fence::NO_FENCE);
    }
}

const compositionengine::LayerFECompositionState* LayerFE::getCompositionState() const {
    return mSnapshot.get();
}
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ struct CompositionResult {
class LayerFE : public virtual RefBase, public virtual compositionengine::LayerFE {
public:
    LayerFE(const std::string& name);
    virtual ~LayerFE();

    // compositionengine::LayerFE overrides
    const compositionengine::LayerFECompositionState* getCompositionState() const override;