diff options
| author | Callum Prentice <callum@lindenlab.com> | 2025-08-07 15:28:48 -0700 |
|---|---|---|
| committer | Callum Prentice <callum@lindenlab.com> | 2025-08-07 15:28:48 -0700 |
| commit | 356b682f617c708c08de9f87b6f25e7683e701fb (patch) | |
| tree | 85af56d748f7de5e74cbd8f2dc04ace70600f7ae /indra/newview | |
| parent | 819817f5c9cebad353f5b86996b5426095dd73b8 (diff) | |
First part of work for #4498. This change forces each CEF instance to have it's own cache/cookie folder underneath the parent cef_cache folder. The whole cef_cache folder structure is purged at startup (before the parent being created at the first media instance creation)
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/llappviewer.cpp | 24 | ||||
| -rw-r--r-- | indra/newview/llappviewer.h | 1 |
2 files changed, 19 insertions, 6 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 28b40543e9..f7168598dc 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4411,6 +4411,9 @@ bool LLAppViewer::initCache() const U32 CACHE_NUMBER_OF_REGIONS_FOR_OBJECTS = 128; LLVOCache::getInstance()->initCache(LL_PATH_CACHE, CACHE_NUMBER_OF_REGIONS_FOR_OBJECTS, getObjectCacheVersion()); + // Remove old, stale CEF cache folders + purgeCefStaleCaches(); + return true; } @@ -4435,18 +4438,27 @@ void LLAppViewer::loadKeyBindings() LLUrlRegistry::instance().setKeybindingHandler(&gViewerInput); } +// As per GHI #4498, remove old, stale CEF cache folders from previous sessions +void LLAppViewer::purgeCefStaleCaches() +{ + // TODO: we really shouldn't use a hard coded name for the cache folder here... + const std::string browser_parent_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "cef_cache"); + if (LLFile::isdir(browser_parent_cache)) + { + // This is a sledgehammer approach - nukes the cef_cache dir entirely + // which is then recreated the first time a CEF instance creates an + // individual cache folder. If we ever decide to retain some folders + // e.g. Search UI cache - then we will need a more granular approach. + gDirUtilp->deleteDirAndContents(browser_parent_cache); + } +} + void LLAppViewer::purgeCache() { LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << LL_ENDL; LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE); LLVOCache::getInstance()->removeCache(LL_PATH_CACHE); LLViewerShaderMgr::instance()->clearShaderCache(); - std::string browser_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "cef_cache"); - if (LLFile::isdir(browser_cache)) - { - // cef does not support clear_cache and clear_cookies, so clear what we can manually. - gDirUtilp->deleteDirAndContents(browser_cache); - } gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), "*"); } diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 14e96afe94..918300f6e5 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -220,6 +220,7 @@ public: void initGeneralThread(); void purgeUserDataOnExit() { mPurgeUserDataOnExit = true; } + void purgeCefStaleCaches(); // Remove old, stale CEF cache folders void purgeCache(); // Clear the local cache. void purgeCacheImmediate(); //clear local cache immediately. S32 updateTextureThreads(F32 max_time); |
