diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2013-03-20 16:29:48 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2013-03-20 16:29:48 -0600 |
commit | 933691ad133b552be3fdd26b0d9d26a09c3a7aa5 (patch) | |
tree | 013fc4663d69057b5f3eff589b33d840e57b8115 /indra/newview | |
parent | 041024e8e5d1f27ab77dc4fa2c1e38b8266e7b41 (diff) |
for SH-4004: interesting: need debug option to clear viewer cache while still logged in
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llvocache.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llvocache.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 10 |
6 files changed, 48 insertions, 6 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0cb7c7b030..dc07c8f13b 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4006,6 +4006,14 @@ void LLAppViewer::purgeCache() gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), "*.*"); } +//purge cache immediately, do not wait until the next login. +void LLAppViewer::purgeCacheImmediate() +{ + LL_INFOS("AppCache") << "Purging Object Cache and Texture Cache immediately..." << LL_ENDL; + LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE); + LLVOCache::getInstance()->removeCache(LL_PATH_CACHE, true); +} + std::string LLAppViewer::getSecondLifeTitle() const { return LLTrans::getString("APP_NAME"); diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 58237d573d..06c06c4af2 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -170,6 +170,7 @@ public: void addOnIdleCallback(const boost::function<void()>& cb); // add a callback to fire (once) when idle void purgeCache(); // Clear the local cache. + void purgeCacheImmediate(); //clear local cache immediately. // mute/unmute the system's master audio virtual void setMasterSystemAudioMute(bool mute); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9a0cb432be..d66287f172 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7572,6 +7572,23 @@ void handle_web_browser_test(const LLSD& param) LLWeb::loadURLInternal(url); } +bool callback_clear_cache_immediately(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( option == 0 ) // YES + { + //clear cache + LLAppViewer::instance()->purgeCacheImmediate(); + } + + return false; +} + +void handle_cache_clear_immediately() +{ + LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache_immediately); +} + void handle_web_content_test(const LLSD& param) { std::string url = param.asString(); @@ -8492,6 +8509,8 @@ void initialize_menus() //Develop (Texture Fetch Debug Console) view_listener_t::addMenu(new LLDevelopTextureFetchDebugger(), "Develop.SetTexFetchDebugger"); + //Develop (clear cache immediately) + commit.add("Develop.ClearCache", boost::bind(&handle_cache_clear_immediately) ); // Admin >Object view_listener_t::addMenu(new LLAdminForceTakeCopy(), "Admin.ForceTakeCopy"); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 5f112675dc..a08e01784c 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -563,13 +563,19 @@ void LLVOCache::initCache(ELLPath location, U32 size, U32 cache_version) } } -void LLVOCache::removeCache(ELLPath location) +void LLVOCache::removeCache(ELLPath location, bool started) { + if(started) + { + removeCache(); + return; + } + if(mReadOnly) { llwarns << "Not removing cache at " << location << ": Cache is currently in read-only mode." << llendl; return ; - } + } llinfos << "about to remove the object cache due to settings." << llendl ; @@ -592,10 +598,8 @@ void LLVOCache::removeCache() return ; } - llinfos << "about to remove the object cache due to some error." << llendl ; - std::string mask = "*"; - llinfos << "Removing cache at " << mObjectCacheDirName << llendl; + llinfos << "Removing object cache at " << mObjectCacheDirName << llendl; gDirUtilp->deleteFilesInDir(mObjectCacheDirName, mask); clearCacheInMemory() ; diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 64eb876919..c26bebb451 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -199,7 +199,7 @@ public: ~LLVOCache() ; void initCache(ELLPath location, U32 size, U32 cache_version) ; - void removeCache(ELLPath location) ; + void removeCache(ELLPath location, bool started = false) ; void readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) ; void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, BOOL full_region_cache_probe); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 5b6a6f908a..7e5b5ed1e9 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2758,6 +2758,16 @@ function="ToggleControl" parameter="RenderHoverGlowEnable" /> </menu_item_check> + <menu_item_separator /> + + <menu_item_call + enabled="true" + label="Clear Cache Immediately" + name="Cache Clear"> + <menu_item_call.on_click + function="Develop.ClearCache" /> + </menu_item_call> + </menu> <menu |