mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1022421 - Cache value of FaviconHelper::GetICOCacheSecondsTimeout() in AsyncDeleteAllFaviconsFromDisk so that we don't use pref service off main thread. r=jimm
This commit is contained in:
parent
6d1e1dbad7
commit
35a88afc17
@ -962,6 +962,9 @@ AsyncDeleteAllFaviconsFromDisk::
|
||||
AsyncDeleteAllFaviconsFromDisk(bool aIgnoreRecent)
|
||||
: mIgnoreRecent(aIgnoreRecent)
|
||||
{
|
||||
// We can't call FaviconHelper::GetICOCacheSecondsTimeout() on non-main
|
||||
// threads, as it reads a pref, so cache its value here.
|
||||
mIcoNoDeleteSeconds = FaviconHelper::GetICOCacheSecondsTimeout() + 600;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP AsyncDeleteAllFaviconsFromDisk::Run()
|
||||
@ -1008,11 +1011,9 @@ NS_IMETHODIMP AsyncDeleteAllFaviconsFromDisk::Run()
|
||||
// If the icon is older than the regeneration time (+ 10 min to be
|
||||
// safe), then it's old and we can get rid of it.
|
||||
// This code is only hit directly after a regeneration.
|
||||
int32_t icoNoDeleteSeconds =
|
||||
FaviconHelper::GetICOCacheSecondsTimeout() + 600;
|
||||
int64_t nowTime = PR_Now() / int64_t(PR_USEC_PER_SEC);
|
||||
if (NS_FAILED(rv) ||
|
||||
(nowTime - fileModTime) < icoNoDeleteSeconds) {
|
||||
(nowTime - fileModTime) < mIcoNoDeleteSeconds) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -414,6 +414,7 @@ public:
|
||||
AsyncDeleteAllFaviconsFromDisk(bool aIgnoreRecent = false);
|
||||
virtual ~AsyncDeleteAllFaviconsFromDisk();
|
||||
private:
|
||||
int32_t mIcoNoDeleteSeconds;
|
||||
bool mIgnoreRecent;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user