|
@@ -7,7 +7,9 @@
|
|
|
#define SPLIT_SLASH_STR "\\"
|
|
|
#else
|
|
|
#include <signal.h>
|
|
|
+#include "toolkit.h"
|
|
|
#include "path.h"
|
|
|
+#include "fileutil.h"
|
|
|
#endif
|
|
|
#include "baseEx.h"
|
|
|
#include "CWebsocketServer.h"
|
|
@@ -173,6 +175,8 @@ namespace Chromium {
|
|
|
CModTools::get_mutable_instance().InitCModTools(this);
|
|
|
CModTools::get_mutable_instance().killAllChromium();
|
|
|
|
|
|
+ DoBrowserCacheClearJob();
|
|
|
+
|
|
|
#if (defined _WIN32 || defined _WIN64)
|
|
|
#else
|
|
|
CSimpleStringA strDbgPath;
|
|
@@ -201,8 +205,6 @@ namespace Chromium {
|
|
|
}).detach();
|
|
|
#endif
|
|
|
|
|
|
-
|
|
|
-
|
|
|
GetFunction()->GetSystemStaticInfo(m_sysInfo);
|
|
|
if (!IsConfigMode()) {
|
|
|
CSmartPointer<IConfigInfo> spConfig;
|
|
@@ -732,7 +734,47 @@ namespace Chromium {
|
|
|
m_firstStartMain.unlock();
|
|
|
};
|
|
|
|
|
|
- void CChromiumEntity::OnTaskTimerListener(void* pData)
|
|
|
+ void CChromiumEntity::DoBrowserCacheClearJob()
|
|
|
+ {
|
|
|
+ LOG_FUNCTION();
|
|
|
+
|
|
|
+ CSmartPointer<IConfigInfo> spConfig;
|
|
|
+ ErrorCodeEnum err = GetFunction()->OpenConfig(Config_Run, spConfig);
|
|
|
+ CSimpleStringA str(true);
|
|
|
+ err = spConfig->ReadConfigValue("Browser", "CacheClear", str);
|
|
|
+ if (str.Compare("true", true) == 0) {
|
|
|
+
|
|
|
+ BOOL bSucc(FALSE);
|
|
|
+ CSimpleStringA strCachePath;
|
|
|
+ GetFunction()->GetPath("Temp", strCachePath);
|
|
|
+ if (!strCachePath.IsNullOrEmpty()) {
|
|
|
+
|
|
|
+ bSucc = TRUE;
|
|
|
+
|
|
|
+ const char* cacheDirs[] = { "cefCache", "cefCache_Ad", "cefCache_breakdown", "cefCache_ErrNotify", "cefCache_main"
|
|
|
+ , "UOSBrowser_Ad", "UOSBrowser_main" };
|
|
|
+
|
|
|
+ for (int i = 0; i < array_size(cacheDirs); ++i) {
|
|
|
+ CSimpleStringA strcefCachePath(strCachePath);
|
|
|
+ strcefCachePath += SPLIT_SLASH_STR;
|
|
|
+ strcefCachePath += cacheDirs[i];
|
|
|
+
|
|
|
+ if (ExistsDirA(strcefCachePath)) {
|
|
|
+ RemoveDirRecursiveA(strcefCachePath);
|
|
|
+ LogWarn(Severity_Middle, Error_Debug, LOG_EVT_CHROMIUM_BROWSER_CACHE_CLEAER,
|
|
|
+ CSimpleStringA::Format("clear chromium browser cache: %s", strcefCachePath.GetData()));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bSucc) {
|
|
|
+ spConfig->WriteConfigValue("Browser", "CacheClear", NULL);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void CChromiumEntity::OnTaskTimerListener(void* pData)
|
|
|
{
|
|
|
static int max_restartTime = 3;
|
|
|
DbgEx("OnTaskTimerListener");
|