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

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

Merge "Some devices might skip sending TRIM_BACKGROUND" into main

parents b95c9fe2 92636453
Loading
Loading
Loading
Loading
+13 −18
Original line number Diff line number Diff line
@@ -124,13 +124,11 @@ void CacheManager::trimMemory(TrimLevel mode) {
    // flush and submit all work to the gpu and wait for it to finish
    mGrContext->flushAndSubmit(GrSyncCpu::kYes);

    switch (mode) {
        case TrimLevel::BACKGROUND:
    if (mode >= TrimLevel::BACKGROUND) {
        mGrContext->freeGpuResources();
        SkGraphics::PurgeAllCaches();
        mRenderThread.destroyRenderingContext();
            break;
        case TrimLevel::UI_HIDDEN:
    } else if (mode == TrimLevel::UI_HIDDEN) {
        // Here we purge all the unlocked scratch resources and then toggle the resources cache
        // limits between the background and max amounts. This causes the unlocked resources
        // that have persistent data to be purged in LRU order.
@@ -139,9 +137,6 @@ void CacheManager::trimMemory(TrimLevel mode) {
        mGrContext->purgeUnlockedResources(toSkiaEnum(mMemoryPolicy.purgeScratchOnly));
        mGrContext->setResourceCacheLimit(mMaxResourceBytes);
        SkGraphics::SetFontCacheLimit(mMaxCpuFontCacheBytes);
            break;
        default:
            break;
    }
}