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

Commit 308393e6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: make RenderEngineThreaded::waitUntilInitialized more efficient" into main

parents 45622511 36135d0e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -125,8 +125,10 @@ void RenderEngineThreaded::threadMain(CreateInstanceFactory factory) NO_THREAD_S
}

void RenderEngineThreaded::waitUntilInitialized() const {
    if (!mIsInitialized) {
        std::unique_lock<std::mutex> lock(mInitializedMutex);
    mInitializedCondition.wait(lock, [=] { return mIsInitialized; });
        mInitializedCondition.wait(lock, [this] { return mIsInitialized.load(); });
    }
}

std::future<void> RenderEngineThreaded::primeCache(bool shouldPrimeUltraHDR) {
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ private:

    // Used to allow select thread safe methods to be accessed without requiring the
    // method to be invoked on the RenderEngine thread
    bool mIsInitialized = false;
    std::atomic_bool mIsInitialized = false;
    mutable std::mutex mInitializedMutex;
    mutable std::condition_variable mInitializedCondition;