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

Commit dc2ea290 authored by Wei Wang's avatar Wei Wang Committed by Android (Google) Code Review
Browse files

Merge "Fix possible leaks in CanvasContext HintSessionWrapper" into udc-qpr-dev

parents 90db903f 10d75fc5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ void CanvasContext::destroy() {
    destroyHardwareResources();
    mAnimationContext->destroy();
    mRenderThread.cacheManager().onContextStopped(this);
    mHintSessionWrapper.destroy();
}

static void setBufferCount(ANativeWindow* window) {
@@ -193,6 +194,7 @@ void CanvasContext::setHardwareBuffer(AHardwareBuffer* buffer) {
void CanvasContext::setSurface(ANativeWindow* window, bool enableTimeout) {
    ATRACE_CALL();

    startHintSession();
    if (window) {
        mNativeSurface = std::make_unique<ReliableSurface>(window);
        mNativeSurface->init();
+9 −0
Original line number Diff line number Diff line
@@ -93,8 +93,17 @@ HintSessionWrapper::HintSessionWrapper(pid_t uiThreadId, pid_t renderThreadId)
        : mUiThreadId(uiThreadId), mRenderThreadId(renderThreadId) {}

HintSessionWrapper::~HintSessionWrapper() {
    destroy();
}

void HintSessionWrapper::destroy() {
    if (mHintSessionFuture.valid()) {
        mHintSession = mHintSessionFuture.get();
    }
    if (mHintSession) {
        gAPH_closeSessionFn(mHintSession);
        mSessionValid = true;
        mHintSession = nullptr;
    }
}

+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ public:
    void sendLoadResetHint();
    void sendLoadIncreaseHint();
    bool init();
    void destroy();

private:
    APerformanceHintSession* mHintSession = nullptr;