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

Commit 3017c615 authored by Irvel's avatar Irvel
Browse files

SF: Change wp usage for deferred transactions in the interceptor to sp

Change-Id: Iebee77d30f0b49dc94c3b23e56683efcb2133993
parent 22851c3b
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -130,7 +130,8 @@ status_t SurfaceInterceptor::writeProtoFileLocked() {
    return NO_ERROR;
    return NO_ERROR;
}
}


const sp<const Layer> SurfaceInterceptor::getLayer(const sp<const IBinder>& handle) {
const sp<const Layer> SurfaceInterceptor::getLayer(const wp<const IBinder>& weakHandle) {
    const sp<const IBinder>& handle(weakHandle.promote());
    const auto layerHandle(static_cast<const Layer::Handle*>(handle.get()));
    const auto layerHandle(static_cast<const Layer::Handle*>(handle.get()));
    const sp<const Layer> layer(layerHandle->owner.promote());
    const sp<const Layer> layer(layerHandle->owner.promote());
    // layer could be a nullptr at this point
    // layer could be a nullptr at this point
@@ -279,10 +280,10 @@ void SurfaceInterceptor::addFinalCropLocked(Transaction* transaction, int32_t la
}
}


void SurfaceInterceptor::addDeferTransactionLocked(Transaction* transaction, int32_t layerId,
void SurfaceInterceptor::addDeferTransactionLocked(Transaction* transaction, int32_t layerId,
        const sp<const IBinder>& handle, uint64_t frameNumber)
        const wp<const IBinder>& weakHandle, uint64_t frameNumber)
{
{
    SurfaceChange* change(createSurfaceChangeLocked(transaction, layerId));
    SurfaceChange* change(createSurfaceChangeLocked(transaction, layerId));
    const sp<const Layer> layer(getLayer(handle));
    const sp<const Layer> layer(getLayer(weakHandle));
    if (layer == nullptr) {
    if (layer == nullptr) {
        ALOGE("An existing layer could not be retrieved with the handle"
        ALOGE("An existing layer could not be retrieved with the handle"
                " for the deferred transaction");
                " for the deferred transaction");
+2 −2
Original line number Original line Diff line number Diff line
@@ -70,7 +70,7 @@ private:
    void addInitialDisplayStateLocked(Increment* increment, const DisplayDeviceState& display);
    void addInitialDisplayStateLocked(Increment* increment, const DisplayDeviceState& display);


    status_t writeProtoFileLocked();
    status_t writeProtoFileLocked();
    const sp<const Layer> getLayer(const sp<const IBinder>& handle);
    const sp<const Layer> getLayer(const wp<const IBinder>& weakHandle);
    const std::string getLayerName(const sp<const Layer>& layer);
    const std::string getLayerName(const sp<const Layer>& layer);
    int32_t getLayerId(const sp<const Layer>& layer);
    int32_t getLayerId(const sp<const Layer>& layer);


@@ -99,7 +99,7 @@ private:
    void addLayerStackLocked(Transaction* transaction, int32_t layerId, uint32_t layerStack);
    void addLayerStackLocked(Transaction* transaction, int32_t layerId, uint32_t layerStack);
    void addCropLocked(Transaction* transaction, int32_t layerId, const Rect& rect);
    void addCropLocked(Transaction* transaction, int32_t layerId, const Rect& rect);
    void addDeferTransactionLocked(Transaction* transaction, int32_t layerId,
    void addDeferTransactionLocked(Transaction* transaction, int32_t layerId,
            const sp<const IBinder>& handle, uint64_t frameNumber);
            const wp<const IBinder>& weakHandle, uint64_t frameNumber);
    void addFinalCropLocked(Transaction* transaction, int32_t layerId, const Rect& rect);
    void addFinalCropLocked(Transaction* transaction, int32_t layerId, const Rect& rect);
    void addOverrideScalingModeLocked(Transaction* transaction, int32_t layerId,
    void addOverrideScalingModeLocked(Transaction* transaction, int32_t layerId,
            int32_t overrideScalingMode);
            int32_t overrideScalingMode);