| File: | root/firefox-clang/obj-x86_64-pc-linux-gnu/netwerk/cache2/./../../../netwerk/cache2/CacheFileContextEvictor.cpp |
| Warning: | line 359, column 5 Value stored to 'rv' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | |
| 5 | #include "CacheFileContextEvictor.h" |
| 6 | |
| 7 | #include "CacheFileIOManager.h" |
| 8 | #include "CacheFileMetadata.h" |
| 9 | #include "CacheFileUtils.h" |
| 10 | #include "CacheIndex.h" |
| 11 | #include "CacheIndexIterator.h" |
| 12 | #include "CacheLog.h" |
| 13 | #include "CacheObserver.h" |
| 14 | #include "LoadContextInfo.h" |
| 15 | #include "mozilla/Base64.h" |
| 16 | #include "mozilla/Components.h" |
| 17 | #include "mozilla/IntegerPrintfMacros.h" |
| 18 | #include "nsCharSeparatedTokenizer.h" |
| 19 | #include "nsContentUtils.h" |
| 20 | #include "nsIDirectoryEnumerator.h" |
| 21 | #include "nsIEffectiveTLDService.h" |
| 22 | #include "nsIFile.h" |
| 23 | #include "nsNetUtil.h" |
| 24 | #include "nsString.h" |
| 25 | #include "nsThreadUtils.h" |
| 26 | |
| 27 | namespace mozilla::net { |
| 28 | |
| 29 | #define CONTEXT_EVICTION_PREFIX"ce_" "ce_" |
| 30 | const uint32_t kContextEvictionPrefixLength = |
| 31 | sizeof(CONTEXT_EVICTION_PREFIX"ce_") - 1; |
| 32 | |
| 33 | bool CacheFileContextEvictor::sDiskAlreadySearched = false; |
| 34 | |
| 35 | CacheFileContextEvictor::CacheFileContextEvictor() { |
| 36 | LOG(("CacheFileContextEvictor::CacheFileContextEvictor() [this=%p]", this))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CacheFileContextEvictor() [this=%p]" , this); } } while (0); |
| 37 | } |
| 38 | |
| 39 | CacheFileContextEvictor::~CacheFileContextEvictor() { |
| 40 | LOG(("CacheFileContextEvictor::~CacheFileContextEvictor() [this=%p]", this))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::~CacheFileContextEvictor() [this=%p]" , this); } } while (0); |
| 41 | } |
| 42 | |
| 43 | nsresult CacheFileContextEvictor::Init(nsIFile* aCacheDirectory) { |
| 44 | LOG(("CacheFileContextEvictor::Init()"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::Init()" ); } } while (0); |
| 45 | |
| 46 | nsresult rv; |
| 47 | |
| 48 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 48); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 48); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 49 | |
| 50 | CacheIndex::IsUpToDate(&mIndexIsUpToDate); |
| 51 | |
| 52 | mCacheDirectory = aCacheDirectory; |
| 53 | |
| 54 | rv = aCacheDirectory->Clone(getter_AddRefs(mEntriesDir)); |
| 55 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 55)) { |
| 56 | return rv; |
| 57 | } |
| 58 | |
| 59 | rv = mEntriesDir->AppendNative(nsLiteralCString(ENTRIES_DIR"entries")); |
| 60 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 60)) { |
| 61 | return rv; |
| 62 | } |
| 63 | |
| 64 | if (!sDiskAlreadySearched) { |
| 65 | LoadEvictInfoFromDisk(); |
| 66 | if ((mEntries.Length() != 0) && mIndexIsUpToDate) { |
| 67 | CreateIterators(); |
| 68 | StartEvicting(); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | return NS_OK; |
| 73 | } |
| 74 | |
| 75 | void CacheFileContextEvictor::Shutdown() { |
| 76 | LOG(("CacheFileContextEvictor::Shutdown()"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::Shutdown()" ); } } while (0); |
| 77 | |
| 78 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 78); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 78); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 79 | |
| 80 | CloseIterators(); |
| 81 | } |
| 82 | |
| 83 | uint32_t CacheFileContextEvictor::ContextsCount() { |
| 84 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 84); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 84); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 85 | |
| 86 | return mEntries.Length(); |
| 87 | } |
| 88 | |
| 89 | nsresult CacheFileContextEvictor::AddContext( |
| 90 | nsILoadContextInfo* aLoadContextInfo, bool aPinned, |
| 91 | const nsAString& aOrigin, const nsAString& aBaseDomain) { |
| 92 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::AddContext() [this=%p, loadContextInfo=%p, " "pinned=%d]", this, aLoadContextInfo, aPinned); } } while (0 ) |
| 93 | ("CacheFileContextEvictor::AddContext() [this=%p, loadContextInfo=%p, "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::AddContext() [this=%p, loadContextInfo=%p, " "pinned=%d]", this, aLoadContextInfo, aPinned); } } while (0 ) |
| 94 | "pinned=%d]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::AddContext() [this=%p, loadContextInfo=%p, " "pinned=%d]", this, aLoadContextInfo, aPinned); } } while (0 ) |
| 95 | this, aLoadContextInfo, aPinned))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::AddContext() [this=%p, loadContextInfo=%p, " "pinned=%d]", this, aLoadContextInfo, aPinned); } } while (0 ); |
| 96 | |
| 97 | MOZ_ASSERT(aOrigin.IsEmpty() || aBaseDomain.IsEmpty(),do { static_assert( mozilla::detail::AssertionConditionType< decltype(aOrigin.IsEmpty() || aBaseDomain.IsEmpty())>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(aOrigin.IsEmpty() || aBaseDomain.IsEmpty()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("aOrigin.IsEmpty() || aBaseDomain.IsEmpty()" " (" "Cannot specify both origin and base domain" ")", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 98); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aOrigin.IsEmpty() || aBaseDomain.IsEmpty()" ") (" "Cannot specify both origin and base domain" ")"); do { MOZ_CrashSequence(__null, 98); __attribute__((nomerge)) ::abort (); } while (false); } } while (false) |
| 98 | "Cannot specify both origin and base domain")do { static_assert( mozilla::detail::AssertionConditionType< decltype(aOrigin.IsEmpty() || aBaseDomain.IsEmpty())>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(aOrigin.IsEmpty() || aBaseDomain.IsEmpty()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("aOrigin.IsEmpty() || aBaseDomain.IsEmpty()" " (" "Cannot specify both origin and base domain" ")", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 98); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aOrigin.IsEmpty() || aBaseDomain.IsEmpty()" ") (" "Cannot specify both origin and base domain" ")"); do { MOZ_CrashSequence(__null, 98); __attribute__((nomerge)) ::abort (); } while (false); } } while (false); |
| 99 | |
| 100 | nsresult rv; |
| 101 | |
| 102 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 102); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 102); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 103 | |
| 104 | CacheFileContextEvictorEntry* entry = nullptr; |
| 105 | if (aLoadContextInfo) { |
| 106 | for (uint32_t i = 0; i < mEntries.Length(); ++i) { |
| 107 | if (mEntries[i]->mInfo && mEntries[i]->mInfo->Equals(aLoadContextInfo) && |
| 108 | mEntries[i]->mPinned == aPinned && |
| 109 | (mEntries[i]->mOrigin.Equals(aOrigin) || |
| 110 | mEntries[i]->mBaseDomain.Equals(aBaseDomain))) { |
| 111 | entry = mEntries[i].get(); |
| 112 | break; |
| 113 | } |
| 114 | } |
| 115 | } else { |
| 116 | // Not providing load context info means we want to delete everything, |
| 117 | // so let's not bother with any currently running context cleanups |
| 118 | // for the same pinning state. |
| 119 | for (uint32_t i = mEntries.Length(); i > 0;) { |
| 120 | --i; |
| 121 | if (mEntries[i]->mInfo && mEntries[i]->mPinned == aPinned) { |
| 122 | RemoveEvictInfoFromDisk(mEntries[i]->mInfo, mEntries[i]->mPinned, |
| 123 | mEntries[i]->mOrigin, mEntries[i]->mBaseDomain); |
| 124 | mEntries.RemoveElementAt(i); |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | if (!entry) { |
| 130 | entry = new CacheFileContextEvictorEntry(); |
| 131 | entry->mInfo = aLoadContextInfo; |
| 132 | entry->mPinned = aPinned; |
| 133 | entry->mOrigin = aOrigin; |
| 134 | entry->mBaseDomain = aBaseDomain; |
| 135 | mEntries.AppendElement(WrapUnique(entry)); |
| 136 | } |
| 137 | |
| 138 | entry->mTimeStamp = PR_Now() / PR_USEC_PER_MSEC1000L; |
| 139 | |
| 140 | PersistEvictionInfoToDisk(aLoadContextInfo, aPinned, aOrigin, aBaseDomain); |
| 141 | |
| 142 | if (mIndexIsUpToDate) { |
| 143 | // Already existing context could be added again, in this case the iterator |
| 144 | // would be recreated. Close the old iterator explicitely. |
| 145 | if (entry->mIterator) { |
| 146 | entry->mIterator->Close(); |
| 147 | entry->mIterator = nullptr; |
| 148 | } |
| 149 | |
| 150 | rv = CacheIndex::GetIterator(aLoadContextInfo, false, |
| 151 | getter_AddRefs(entry->mIterator)); |
| 152 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 153 | // This could probably happen during shutdown. Remove the entry from |
| 154 | // the array, but leave the info on the disk. No entry can be opened |
| 155 | // during shutdown and we'll load the eviction info on next start. |
| 156 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::AddContext() - Cannot get an iterator. " "[rv=0x%08" "x" "]", static_cast<uint32_t>(rv)); } } while (0) |
| 157 | ("CacheFileContextEvictor::AddContext() - Cannot get an iterator. "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::AddContext() - Cannot get an iterator. " "[rv=0x%08" "x" "]", static_cast<uint32_t>(rv)); } } while (0) |
| 158 | "[rv=0x%08" PRIx32 "]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::AddContext() - Cannot get an iterator. " "[rv=0x%08" "x" "]", static_cast<uint32_t>(rv)); } } while (0) |
| 159 | static_cast<uint32_t>(rv)))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::AddContext() - Cannot get an iterator. " "[rv=0x%08" "x" "]", static_cast<uint32_t>(rv)); } } while (0); |
| 160 | mEntries.RemoveElement(entry); |
| 161 | return rv; |
| 162 | } |
| 163 | |
| 164 | StartEvicting(); |
| 165 | } |
| 166 | |
| 167 | return NS_OK; |
| 168 | } |
| 169 | |
| 170 | void CacheFileContextEvictor::CacheIndexStateChanged() { |
| 171 | LOG(("CacheFileContextEvictor::CacheIndexStateChanged() [this=%p]", this))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CacheIndexStateChanged() [this=%p]" , this); } } while (0); |
| 172 | |
| 173 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 173); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 173); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 174 | |
| 175 | bool isUpToDate = false; |
| 176 | CacheIndex::IsUpToDate(&isUpToDate); |
| 177 | if (mEntries.Length() == 0) { |
| 178 | // Just save the state and exit, since there is nothing to do |
| 179 | mIndexIsUpToDate = isUpToDate; |
| 180 | return; |
| 181 | } |
| 182 | |
| 183 | if (!isUpToDate && !mIndexIsUpToDate) { |
| 184 | // Index is outdated and status has not changed, nothing to do. |
| 185 | return; |
| 186 | } |
| 187 | |
| 188 | if (isUpToDate && mIndexIsUpToDate) { |
| 189 | // Status has not changed, but make sure the eviction is running. |
| 190 | if (mEvicting) { |
| 191 | return; |
| 192 | } |
| 193 | |
| 194 | // We're not evicting, but we should be evicting?! |
| 195 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CacheIndexStateChanged() - Index is up to " "date, we have some context to evict but eviction is not running! " "Starting now."); } } while (0) |
| 196 | ("CacheFileContextEvictor::CacheIndexStateChanged() - Index is up to "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CacheIndexStateChanged() - Index is up to " "date, we have some context to evict but eviction is not running! " "Starting now."); } } while (0) |
| 197 | "date, we have some context to evict but eviction is not running! "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CacheIndexStateChanged() - Index is up to " "date, we have some context to evict but eviction is not running! " "Starting now."); } } while (0) |
| 198 | "Starting now."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CacheIndexStateChanged() - Index is up to " "date, we have some context to evict but eviction is not running! " "Starting now."); } } while (0); |
| 199 | } |
| 200 | |
| 201 | mIndexIsUpToDate = isUpToDate; |
| 202 | |
| 203 | if (mIndexIsUpToDate) { |
| 204 | CreateIterators(); |
| 205 | StartEvicting(); |
| 206 | } else { |
| 207 | CloseIterators(); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | void CacheFileContextEvictor::WasEvicted(const nsACString& aKey, nsIFile* aFile, |
| 212 | bool* aEvictedAsPinned, |
| 213 | bool* aEvictedAsNonPinned) { |
| 214 | LOG(("CacheFileContextEvictor::WasEvicted() [key=%s]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::WasEvicted() [key=%s]" , TPromiseFlatString<char>(aKey).get()); } } while (0) |
| 215 | PromiseFlatCString(aKey).get()))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::WasEvicted() [key=%s]" , TPromiseFlatString<char>(aKey).get()); } } while (0); |
| 216 | |
| 217 | *aEvictedAsPinned = false; |
| 218 | *aEvictedAsNonPinned = false; |
| 219 | |
| 220 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 220); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 220); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 221 | |
| 222 | nsCOMPtr<nsILoadContextInfo> info = CacheFileUtils::ParseKey(aKey); |
| 223 | MOZ_ASSERT(info)do { static_assert( mozilla::detail::AssertionConditionType< decltype(info)>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(!!(info))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("info", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 223); AnnotateMozCrashReason("MOZ_ASSERT" "(" "info" ")"); do { MOZ_CrashSequence(__null, 223); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); |
| 224 | if (!info) { |
| 225 | LOG(("CacheFileContextEvictor::WasEvicted() - Cannot parse key!"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::WasEvicted() - Cannot parse key!" ); } } while (0); |
| 226 | return; |
| 227 | } |
| 228 | |
| 229 | for (uint32_t i = 0; i < mEntries.Length(); ++i) { |
| 230 | const auto& entry = mEntries[i]; |
| 231 | |
| 232 | if (entry->mInfo && !info->Equals(entry->mInfo)) { |
| 233 | continue; |
| 234 | } |
| 235 | |
| 236 | PRTime lastModifiedTime; |
| 237 | if (NS_FAILED(aFile->GetLastModifiedTime(&lastModifiedTime))((bool)(__builtin_expect(!!(NS_FAILED_impl(aFile->GetLastModifiedTime (&lastModifiedTime))), 0)))) { |
| 238 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::WasEvicted() - Cannot get last modified " "time, returning."); } } while (0) |
| 239 | ("CacheFileContextEvictor::WasEvicted() - Cannot get last modified "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::WasEvicted() - Cannot get last modified " "time, returning."); } } while (0) |
| 240 | "time, returning."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::WasEvicted() - Cannot get last modified " "time, returning."); } } while (0); |
| 241 | return; |
| 242 | } |
| 243 | |
| 244 | if (lastModifiedTime > entry->mTimeStamp) { |
| 245 | // File has been modified since context eviction. |
| 246 | continue; |
| 247 | } |
| 248 | |
| 249 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::WasEvicted() - evicted [pinning=%d, " "mTimeStamp=%" "l" "d" ", lastModifiedTime=%" "l" "d" "]", entry ->mPinned, entry->mTimeStamp, lastModifiedTime); } } while (0) |
| 250 | ("CacheFileContextEvictor::WasEvicted() - evicted [pinning=%d, "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::WasEvicted() - evicted [pinning=%d, " "mTimeStamp=%" "l" "d" ", lastModifiedTime=%" "l" "d" "]", entry ->mPinned, entry->mTimeStamp, lastModifiedTime); } } while (0) |
| 251 | "mTimeStamp=%" PRId64 ", lastModifiedTime=%" PRId64 "]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::WasEvicted() - evicted [pinning=%d, " "mTimeStamp=%" "l" "d" ", lastModifiedTime=%" "l" "d" "]", entry ->mPinned, entry->mTimeStamp, lastModifiedTime); } } while (0) |
| 252 | entry->mPinned, entry->mTimeStamp, lastModifiedTime))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::WasEvicted() - evicted [pinning=%d, " "mTimeStamp=%" "l" "d" ", lastModifiedTime=%" "l" "d" "]", entry ->mPinned, entry->mTimeStamp, lastModifiedTime); } } while (0); |
| 253 | |
| 254 | if (entry->mPinned) { |
| 255 | *aEvictedAsPinned = true; |
| 256 | } else { |
| 257 | *aEvictedAsNonPinned = true; |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | nsresult CacheFileContextEvictor::PersistEvictionInfoToDisk( |
| 263 | nsILoadContextInfo* aLoadContextInfo, bool aPinned, |
| 264 | const nsAString& aOrigin, const nsAString& aBaseDomain) { |
| 265 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() [this=%p, " "loadContextInfo=%p]", this, aLoadContextInfo); } } while (0 ) |
| 266 | ("CacheFileContextEvictor::PersistEvictionInfoToDisk() [this=%p, "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() [this=%p, " "loadContextInfo=%p]", this, aLoadContextInfo); } } while (0 ) |
| 267 | "loadContextInfo=%p]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() [this=%p, " "loadContextInfo=%p]", this, aLoadContextInfo); } } while (0 ) |
| 268 | this, aLoadContextInfo))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() [this=%p, " "loadContextInfo=%p]", this, aLoadContextInfo); } } while (0 ); |
| 269 | |
| 270 | nsresult rv; |
| 271 | |
| 272 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 272); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 272); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 273 | |
| 274 | nsCOMPtr<nsIFile> file; |
| 275 | rv = GetContextFile(aLoadContextInfo, aPinned, aOrigin, aBaseDomain, |
| 276 | getter_AddRefs(file)); |
| 277 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 277)) { |
| 278 | return rv; |
| 279 | } |
| 280 | |
| 281 | nsCString path = file->HumanReadablePath(); |
| 282 | |
| 283 | PRFileDesc* fd; |
| 284 | rv = |
| 285 | file->OpenNSPRFileDesc(PR_RDWR0x04 | PR_CREATE_FILE0x08 | PR_TRUNCATE0x20, 0600, &fd); |
| 286 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 286)) { |
| 287 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() - Creating file " "failed! [path=%s, rv=0x%08" "x" "]", path.get(), static_cast <uint32_t>(rv)); } } while (0) |
| 288 | ("CacheFileContextEvictor::PersistEvictionInfoToDisk() - Creating file "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() - Creating file " "failed! [path=%s, rv=0x%08" "x" "]", path.get(), static_cast <uint32_t>(rv)); } } while (0) |
| 289 | "failed! [path=%s, rv=0x%08" PRIx32 "]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() - Creating file " "failed! [path=%s, rv=0x%08" "x" "]", path.get(), static_cast <uint32_t>(rv)); } } while (0) |
| 290 | path.get(), static_cast<uint32_t>(rv)))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() - Creating file " "failed! [path=%s, rv=0x%08" "x" "]", path.get(), static_cast <uint32_t>(rv)); } } while (0); |
| 291 | return rv; |
| 292 | } |
| 293 | |
| 294 | PR_Close(fd); |
| 295 | |
| 296 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() - Successfully " "created file. [path=%s]", path.get()); } } while (0) |
| 297 | ("CacheFileContextEvictor::PersistEvictionInfoToDisk() - Successfully "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() - Successfully " "created file. [path=%s]", path.get()); } } while (0) |
| 298 | "created file. [path=%s]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() - Successfully " "created file. [path=%s]", path.get()); } } while (0) |
| 299 | path.get()))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::PersistEvictionInfoToDisk() - Successfully " "created file. [path=%s]", path.get()); } } while (0); |
| 300 | |
| 301 | return NS_OK; |
| 302 | } |
| 303 | |
| 304 | nsresult CacheFileContextEvictor::RemoveEvictInfoFromDisk( |
| 305 | nsILoadContextInfo* aLoadContextInfo, bool aPinned, |
| 306 | const nsAString& aOrigin, const nsAString& aBaseDomain) { |
| 307 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictInfoFromDisk() [this=%p, " "loadContextInfo=%p]", this, aLoadContextInfo); } } while (0 ) |
| 308 | ("CacheFileContextEvictor::RemoveEvictInfoFromDisk() [this=%p, "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictInfoFromDisk() [this=%p, " "loadContextInfo=%p]", this, aLoadContextInfo); } } while (0 ) |
| 309 | "loadContextInfo=%p]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictInfoFromDisk() [this=%p, " "loadContextInfo=%p]", this, aLoadContextInfo); } } while (0 ) |
| 310 | this, aLoadContextInfo))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictInfoFromDisk() [this=%p, " "loadContextInfo=%p]", this, aLoadContextInfo); } } while (0 ); |
| 311 | |
| 312 | nsresult rv; |
| 313 | |
| 314 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 314); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 314); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 315 | |
| 316 | nsCOMPtr<nsIFile> file; |
| 317 | rv = GetContextFile(aLoadContextInfo, aPinned, aOrigin, aBaseDomain, |
| 318 | getter_AddRefs(file)); |
| 319 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 319)) { |
| 320 | return rv; |
| 321 | } |
| 322 | |
| 323 | nsCString path = file->HumanReadablePath(); |
| 324 | |
| 325 | rv = file->Remove(false); |
| 326 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 326)) { |
| 327 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictionInfoFromDisk() - Removing file" " failed! [path=%s, rv=0x%08" "x" "]", path.get(), static_cast <uint32_t>(rv)); } } while (0) |
| 328 | ("CacheFileContextEvictor::RemoveEvictionInfoFromDisk() - Removing file"do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictionInfoFromDisk() - Removing file" " failed! [path=%s, rv=0x%08" "x" "]", path.get(), static_cast <uint32_t>(rv)); } } while (0) |
| 329 | " failed! [path=%s, rv=0x%08" PRIx32 "]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictionInfoFromDisk() - Removing file" " failed! [path=%s, rv=0x%08" "x" "]", path.get(), static_cast <uint32_t>(rv)); } } while (0) |
| 330 | path.get(), static_cast<uint32_t>(rv)))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictionInfoFromDisk() - Removing file" " failed! [path=%s, rv=0x%08" "x" "]", path.get(), static_cast <uint32_t>(rv)); } } while (0); |
| 331 | return rv; |
| 332 | } |
| 333 | |
| 334 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictionInfoFromDisk() - Successfully " "removed file. [path=%s]", path.get()); } } while (0) |
| 335 | ("CacheFileContextEvictor::RemoveEvictionInfoFromDisk() - Successfully "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictionInfoFromDisk() - Successfully " "removed file. [path=%s]", path.get()); } } while (0) |
| 336 | "removed file. [path=%s]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictionInfoFromDisk() - Successfully " "removed file. [path=%s]", path.get()); } } while (0) |
| 337 | path.get()))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::RemoveEvictionInfoFromDisk() - Successfully " "removed file. [path=%s]", path.get()); } } while (0); |
| 338 | |
| 339 | return NS_OK; |
| 340 | } |
| 341 | |
| 342 | nsresult CacheFileContextEvictor::LoadEvictInfoFromDisk() { |
| 343 | LOG(("CacheFileContextEvictor::LoadEvictInfoFromDisk() [this=%p]", this))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() [this=%p]" , this); } } while (0); |
| 344 | |
| 345 | nsresult rv; |
| 346 | |
| 347 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 347); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 347); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 348 | |
| 349 | sDiskAlreadySearched = true; |
| 350 | |
| 351 | nsCOMPtr<nsIDirectoryEnumerator> dirEnum; |
| 352 | rv = mCacheDirectory->GetDirectoryEntries(getter_AddRefs(dirEnum)); |
| 353 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 353)) { |
| 354 | return rv; |
| 355 | } |
| 356 | |
| 357 | while (true) { |
| 358 | nsCOMPtr<nsIFile> file; |
| 359 | rv = dirEnum->GetNextFile(getter_AddRefs(file)); |
Value stored to 'rv' is never read | |
| 360 | if (!file) { |
| 361 | break; |
| 362 | } |
| 363 | |
| 364 | bool isDir = false; |
| 365 | file->IsDirectory(&isDir); |
| 366 | if (isDir) { |
| 367 | continue; |
| 368 | } |
| 369 | |
| 370 | nsAutoCString leaf; |
| 371 | rv = file->GetNativeLeafName(leaf); |
| 372 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 373 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - " "GetNativeLeafName() failed! Skipping file."); } } while (0) |
| 374 | ("CacheFileContextEvictor::LoadEvictInfoFromDisk() - "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - " "GetNativeLeafName() failed! Skipping file."); } } while (0) |
| 375 | "GetNativeLeafName() failed! Skipping file."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - " "GetNativeLeafName() failed! Skipping file."); } } while (0); |
| 376 | continue; |
| 377 | } |
| 378 | |
| 379 | if (leaf.Length() < kContextEvictionPrefixLength) { |
| 380 | continue; |
| 381 | } |
| 382 | |
| 383 | if (!StringBeginsWith(leaf, nsLiteralCString(CONTEXT_EVICTION_PREFIX"ce_"))) { |
| 384 | continue; |
| 385 | } |
| 386 | |
| 387 | nsAutoCString encoded; |
| 388 | encoded = Substring(leaf, kContextEvictionPrefixLength); |
| 389 | encoded.ReplaceChar('-', '/'); |
| 390 | |
| 391 | nsAutoCString decoded; |
| 392 | rv = Base64Decode(encoded, decoded); |
| 393 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 394 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - Base64 decoding " "failed. Removing the file. [file=%s]", leaf.get()); } } while (0) |
| 395 | ("CacheFileContextEvictor::LoadEvictInfoFromDisk() - Base64 decoding "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - Base64 decoding " "failed. Removing the file. [file=%s]", leaf.get()); } } while (0) |
| 396 | "failed. Removing the file. [file=%s]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - Base64 decoding " "failed. Removing the file. [file=%s]", leaf.get()); } } while (0) |
| 397 | leaf.get()))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - Base64 decoding " "failed. Removing the file. [file=%s]", leaf.get()); } } while (0); |
| 398 | file->Remove(false); |
| 399 | continue; |
| 400 | } |
| 401 | |
| 402 | bool pinned = decoded[0] == '\t'; |
| 403 | if (pinned) { |
| 404 | decoded = Substring(decoded, 1); |
| 405 | } |
| 406 | |
| 407 | nsAutoCString origin; |
| 408 | nsAutoCString baseDomain; |
| 409 | if (decoded.Contains('\t')) { |
| 410 | auto split = decoded.Split('\t'); |
| 411 | MOZ_ASSERT(decoded.CountChar('\t') == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(decoded.CountChar('\t') == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(decoded.CountChar('\t') == 1 ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "decoded.CountChar('\\t') == 1", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 411); AnnotateMozCrashReason("MOZ_ASSERT" "(" "decoded.CountChar('\\t') == 1" ")"); do { MOZ_CrashSequence(__null, 411); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 412 | |
| 413 | auto splitIt = split.begin(); |
| 414 | nsAutoCString value(*splitIt); |
| 415 | ++splitIt; |
| 416 | decoded = *splitIt; |
| 417 | |
| 418 | // Check if this is a base domain entry (prefixed with 's:') |
| 419 | if (StringBeginsWith(value, "s:"_ns)) { |
| 420 | baseDomain = nsAutoCString(Substring(value, 2)); |
| 421 | } else { |
| 422 | origin = value; |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | nsCOMPtr<nsILoadContextInfo> info; |
| 427 | if (!"*"_ns.Equals(decoded)) { |
| 428 | // "*" is indication of 'delete all', info left null will pass |
| 429 | // to CacheFileContextEvictor::AddContext and clear all the cache data. |
| 430 | info = CacheFileUtils::ParseKey(decoded); |
| 431 | if (!info) { |
| 432 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - Cannot parse " "context key, removing file. [contextKey=%s, file=%s]", decoded .get(), leaf.get()); } } while (0) |
| 433 | ("CacheFileContextEvictor::LoadEvictInfoFromDisk() - Cannot parse "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - Cannot parse " "context key, removing file. [contextKey=%s, file=%s]", decoded .get(), leaf.get()); } } while (0) |
| 434 | "context key, removing file. [contextKey=%s, file=%s]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - Cannot parse " "context key, removing file. [contextKey=%s, file=%s]", decoded .get(), leaf.get()); } } while (0) |
| 435 | decoded.get(), leaf.get()))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::LoadEvictInfoFromDisk() - Cannot parse " "context key, removing file. [contextKey=%s, file=%s]", decoded .get(), leaf.get()); } } while (0); |
| 436 | file->Remove(false); |
| 437 | continue; |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | PRTime lastModifiedTime; |
| 442 | rv = file->GetLastModifiedTime(&lastModifiedTime); |
| 443 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 444 | continue; |
| 445 | } |
| 446 | |
| 447 | auto entry = std::make_unique<CacheFileContextEvictorEntry>(); |
| 448 | entry->mInfo = std::move(info); |
| 449 | entry->mPinned = pinned; |
| 450 | CopyUTF8toUTF16(origin, entry->mOrigin); |
| 451 | CopyUTF8toUTF16(baseDomain, entry->mBaseDomain); |
| 452 | entry->mTimeStamp = lastModifiedTime; |
| 453 | mEntries.AppendElement(std::move(entry)); |
| 454 | } |
| 455 | |
| 456 | return NS_OK; |
| 457 | } |
| 458 | |
| 459 | nsresult CacheFileContextEvictor::GetContextFile( |
| 460 | nsILoadContextInfo* aLoadContextInfo, bool aPinned, |
| 461 | const nsAString& aOrigin, const nsAString& aBaseDomain, nsIFile** _retval) { |
| 462 | MOZ_ASSERT(aOrigin.IsEmpty() || aBaseDomain.IsEmpty(),do { static_assert( mozilla::detail::AssertionConditionType< decltype(aOrigin.IsEmpty() || aBaseDomain.IsEmpty())>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(aOrigin.IsEmpty() || aBaseDomain.IsEmpty()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("aOrigin.IsEmpty() || aBaseDomain.IsEmpty()" " (" "Cannot specify both origin and base domain" ")", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 463); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aOrigin.IsEmpty() || aBaseDomain.IsEmpty()" ") (" "Cannot specify both origin and base domain" ")"); do { MOZ_CrashSequence(__null, 463); __attribute__((nomerge)) ::abort (); } while (false); } } while (false) |
| 463 | "Cannot specify both origin and base domain")do { static_assert( mozilla::detail::AssertionConditionType< decltype(aOrigin.IsEmpty() || aBaseDomain.IsEmpty())>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(aOrigin.IsEmpty() || aBaseDomain.IsEmpty()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("aOrigin.IsEmpty() || aBaseDomain.IsEmpty()" " (" "Cannot specify both origin and base domain" ")", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 463); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aOrigin.IsEmpty() || aBaseDomain.IsEmpty()" ") (" "Cannot specify both origin and base domain" ")"); do { MOZ_CrashSequence(__null, 463); __attribute__((nomerge)) ::abort (); } while (false); } } while (false); |
| 464 | nsresult rv; |
| 465 | |
| 466 | nsAutoCString keyPrefix; |
| 467 | if (aPinned) { |
| 468 | // Mark pinned context files with a tab char at the start. |
| 469 | // Tab is chosen because it can never be used as a context key tag. |
| 470 | keyPrefix.Append('\t'); |
| 471 | } |
| 472 | if (aLoadContextInfo) { |
| 473 | CacheFileUtils::AppendKeyPrefix(aLoadContextInfo, keyPrefix); |
| 474 | } else { |
| 475 | keyPrefix.Append('*'); |
| 476 | } |
| 477 | |
| 478 | if (!aOrigin.IsEmpty()) { |
| 479 | keyPrefix.Append('\t'); |
| 480 | keyPrefix.Append(NS_ConvertUTF16toUTF8(aOrigin)); |
| 481 | } else if (!aBaseDomain.IsEmpty()) { |
| 482 | keyPrefix.Append('\t'); |
| 483 | keyPrefix.AppendLiteral("s:"); // Prefix to identify base domain entries |
| 484 | keyPrefix.Append(NS_ConvertUTF16toUTF8(aBaseDomain)); |
| 485 | } |
| 486 | |
| 487 | nsAutoCString leafName; |
| 488 | leafName.AssignLiteral(CONTEXT_EVICTION_PREFIX"ce_"); |
| 489 | |
| 490 | rv = Base64EncodeAppend(keyPrefix, leafName); |
| 491 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 491)) { |
| 492 | return rv; |
| 493 | } |
| 494 | |
| 495 | // Replace '/' with '-' since '/' cannot be part of the filename. |
| 496 | leafName.ReplaceChar('/', '-'); |
| 497 | |
| 498 | nsCOMPtr<nsIFile> file; |
| 499 | rv = mCacheDirectory->Clone(getter_AddRefs(file)); |
| 500 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 500)) { |
| 501 | return rv; |
| 502 | } |
| 503 | |
| 504 | rv = file->AppendNative(leafName); |
| 505 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 505)) { |
| 506 | return rv; |
| 507 | } |
| 508 | |
| 509 | file.swap(*_retval); |
| 510 | return NS_OK; |
| 511 | } |
| 512 | |
| 513 | void CacheFileContextEvictor::CreateIterators() { |
| 514 | LOG(("CacheFileContextEvictor::CreateIterators() [this=%p]", this))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CreateIterators() [this=%p]" , this); } } while (0); |
| 515 | |
| 516 | CloseIterators(); |
| 517 | |
| 518 | nsresult rv; |
| 519 | |
| 520 | for (uint32_t i = 0; i < mEntries.Length();) { |
| 521 | rv = CacheIndex::GetIterator(mEntries[i]->mInfo, false, |
| 522 | getter_AddRefs(mEntries[i]->mIterator)); |
| 523 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 524 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CreateIterators() - Cannot get an iterator" ". [rv=0x%08" "x" "]", static_cast<uint32_t>(rv)); } } while (0) |
| 525 | ("CacheFileContextEvictor::CreateIterators() - Cannot get an iterator"do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CreateIterators() - Cannot get an iterator" ". [rv=0x%08" "x" "]", static_cast<uint32_t>(rv)); } } while (0) |
| 526 | ". [rv=0x%08" PRIx32 "]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CreateIterators() - Cannot get an iterator" ". [rv=0x%08" "x" "]", static_cast<uint32_t>(rv)); } } while (0) |
| 527 | static_cast<uint32_t>(rv)))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CreateIterators() - Cannot get an iterator" ". [rv=0x%08" "x" "]", static_cast<uint32_t>(rv)); } } while (0); |
| 528 | mEntries.RemoveElementAt(i); |
| 529 | continue; |
| 530 | } |
| 531 | |
| 532 | ++i; |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | void CacheFileContextEvictor::CloseIterators() { |
| 537 | LOG(("CacheFileContextEvictor::CloseIterators() [this=%p]", this))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::CloseIterators() [this=%p]" , this); } } while (0); |
| 538 | |
| 539 | for (uint32_t i = 0; i < mEntries.Length(); ++i) { |
| 540 | if (mEntries[i]->mIterator) { |
| 541 | mEntries[i]->mIterator->Close(); |
| 542 | mEntries[i]->mIterator = nullptr; |
| 543 | } |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | void CacheFileContextEvictor::StartEvicting() { |
| 548 | LOG(("CacheFileContextEvictor::StartEvicting() [this=%p]", this))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::StartEvicting() [this=%p]" , this); } } while (0); |
| 549 | |
| 550 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 550); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 550); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 551 | |
| 552 | if (mEvicting) { |
| 553 | LOG(("CacheFileContextEvictor::StartEvicting() - already evicting."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::StartEvicting() - already evicting." ); } } while (0); |
| 554 | return; |
| 555 | } |
| 556 | |
| 557 | if (mEntries.Length() == 0) { |
| 558 | LOG(("CacheFileContextEvictor::StartEvicting() - no context to evict."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::StartEvicting() - no context to evict." ); } } while (0); |
| 559 | return; |
| 560 | } |
| 561 | |
| 562 | nsCOMPtr<nsIRunnable> ev = |
| 563 | NewRunnableMethod("net::CacheFileContextEvictor::EvictEntries", this, |
| 564 | &CacheFileContextEvictor::EvictEntries); |
| 565 | |
| 566 | RefPtr<CacheIOThread> ioThread = CacheFileIOManager::IOThread(); |
| 567 | |
| 568 | nsresult rv = ioThread->Dispatch(ev, CacheIOThread::EVICT); |
| 569 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 570 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::StartEvicting() - Cannot dispatch event to " "IO thread. [rv=0x%08" "x" "]", static_cast<uint32_t>( rv)); } } while (0) |
| 571 | ("CacheFileContextEvictor::StartEvicting() - Cannot dispatch event to "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::StartEvicting() - Cannot dispatch event to " "IO thread. [rv=0x%08" "x" "]", static_cast<uint32_t>( rv)); } } while (0) |
| 572 | "IO thread. [rv=0x%08" PRIx32 "]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::StartEvicting() - Cannot dispatch event to " "IO thread. [rv=0x%08" "x" "]", static_cast<uint32_t>( rv)); } } while (0) |
| 573 | static_cast<uint32_t>(rv)))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::StartEvicting() - Cannot dispatch event to " "IO thread. [rv=0x%08" "x" "]", static_cast<uint32_t>( rv)); } } while (0); |
| 574 | } |
| 575 | |
| 576 | mEvicting = true; |
| 577 | } |
| 578 | |
| 579 | void CacheFileContextEvictor::EvictEntries() { |
| 580 | LOG(("CacheFileContextEvictor::EvictEntries()"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries()" ); } } while (0); |
| 581 | |
| 582 | nsresult rv; |
| 583 | |
| 584 | MOZ_ASSERT(CacheFileIOManager::IsOnIOThread())do { static_assert( mozilla::detail::AssertionConditionType< decltype(CacheFileIOManager::IsOnIOThread())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(CacheFileIOManager::IsOnIOThread ()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("CacheFileIOManager::IsOnIOThread()", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 584); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()" ")"); do { MOZ_CrashSequence(__null, 584); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 585 | |
| 586 | mEvicting = false; |
| 587 | |
| 588 | if (!mIndexIsUpToDate) { |
| 589 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Stopping evicting due to " "outdated index."); } } while (0) |
| 590 | ("CacheFileContextEvictor::EvictEntries() - Stopping evicting due to "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Stopping evicting due to " "outdated index."); } } while (0) |
| 591 | "outdated index."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Stopping evicting due to " "outdated index."); } } while (0); |
| 592 | return; |
| 593 | } |
| 594 | |
| 595 | nsCOMPtr<nsIEffectiveTLDService> tldService = |
| 596 | mozilla::components::EffectiveTLD::Service(); |
| 597 | MOZ_ASSERT(tldService)do { static_assert( mozilla::detail::AssertionConditionType< decltype(tldService)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(tldService))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("tldService", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 597); AnnotateMozCrashReason("MOZ_ASSERT" "(" "tldService" ")" ); do { MOZ_CrashSequence(__null, 597); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 598 | |
| 599 | while (true) { |
| 600 | if (CacheObserver::ShuttingDown()) { |
| 601 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Stopping evicting due to " "shutdown."); } } while (0) |
| 602 | ("CacheFileContextEvictor::EvictEntries() - Stopping evicting due to "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Stopping evicting due to " "shutdown."); } } while (0) |
| 603 | "shutdown."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Stopping evicting due to " "shutdown."); } } while (0); |
| 604 | mEvicting = |
| 605 | true; // We don't want to start eviction again during shutdown |
| 606 | // process. Setting this flag to true ensures it. |
| 607 | return; |
| 608 | } |
| 609 | |
| 610 | if (CacheIOThread::YieldAndRerun()) { |
| 611 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Breaking loop for higher " "level events."); } } while (0) |
| 612 | ("CacheFileContextEvictor::EvictEntries() - Breaking loop for higher "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Breaking loop for higher " "level events."); } } while (0) |
| 613 | "level events."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Breaking loop for higher " "level events."); } } while (0); |
| 614 | mEvicting = true; |
| 615 | return; |
| 616 | } |
| 617 | |
| 618 | if (mEntries.Length() == 0) { |
| 619 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Stopping evicting, there " "is no context to evict."); } } while (0) |
| 620 | ("CacheFileContextEvictor::EvictEntries() - Stopping evicting, there "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Stopping evicting, there " "is no context to evict."); } } while (0) |
| 621 | "is no context to evict."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Stopping evicting, there " "is no context to evict."); } } while (0); |
| 622 | |
| 623 | // Allow index to notify AsyncGetDiskConsumption callbacks. The size is |
| 624 | // actual again. |
| 625 | CacheIndex::OnAsyncEviction(false); |
| 626 | return; |
| 627 | } |
| 628 | |
| 629 | SHA1Sum::Hash hash; |
| 630 | rv = mEntries[0]->mIterator->GetNextHash(&hash); |
| 631 | if (rv == NS_ERROR_NOT_AVAILABLE) { |
| 632 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - No more entries left in " "iterator. [iterator=%p, info=%p]", mEntries[0]->mIterator .get(), mEntries[0]->mInfo.get()); } } while (0) |
| 633 | ("CacheFileContextEvictor::EvictEntries() - No more entries left in "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - No more entries left in " "iterator. [iterator=%p, info=%p]", mEntries[0]->mIterator .get(), mEntries[0]->mInfo.get()); } } while (0) |
| 634 | "iterator. [iterator=%p, info=%p]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - No more entries left in " "iterator. [iterator=%p, info=%p]", mEntries[0]->mIterator .get(), mEntries[0]->mInfo.get()); } } while (0) |
| 635 | mEntries[0]->mIterator.get(), mEntries[0]->mInfo.get()))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - No more entries left in " "iterator. [iterator=%p, info=%p]", mEntries[0]->mIterator .get(), mEntries[0]->mInfo.get()); } } while (0); |
| 636 | RemoveEvictInfoFromDisk(mEntries[0]->mInfo, mEntries[0]->mPinned, |
| 637 | mEntries[0]->mOrigin, mEntries[0]->mBaseDomain); |
| 638 | mEntries.RemoveElementAt(0); |
| 639 | continue; |
| 640 | } |
| 641 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 642 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Iterator failed to " "provide next hash (shutdown?), keeping eviction info on disk." " [iterator=%p, info=%p]", mEntries[0]->mIterator.get(), mEntries [0]->mInfo.get()); } } while (0) |
| 643 | ("CacheFileContextEvictor::EvictEntries() - Iterator failed to "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Iterator failed to " "provide next hash (shutdown?), keeping eviction info on disk." " [iterator=%p, info=%p]", mEntries[0]->mIterator.get(), mEntries [0]->mInfo.get()); } } while (0) |
| 644 | "provide next hash (shutdown?), keeping eviction info on disk."do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Iterator failed to " "provide next hash (shutdown?), keeping eviction info on disk." " [iterator=%p, info=%p]", mEntries[0]->mIterator.get(), mEntries [0]->mInfo.get()); } } while (0) |
| 645 | " [iterator=%p, info=%p]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Iterator failed to " "provide next hash (shutdown?), keeping eviction info on disk." " [iterator=%p, info=%p]", mEntries[0]->mIterator.get(), mEntries [0]->mInfo.get()); } } while (0) |
| 646 | mEntries[0]->mIterator.get(), mEntries[0]->mInfo.get()))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Iterator failed to " "provide next hash (shutdown?), keeping eviction info on disk." " [iterator=%p, info=%p]", mEntries[0]->mIterator.get(), mEntries [0]->mInfo.get()); } } while (0); |
| 647 | mEntries.RemoveElementAt(0); |
| 648 | continue; |
| 649 | } |
| 650 | |
| 651 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Processing hash. " "[hash=%08x%08x%08x%08x%08x, iterator=%p, info=%p]", PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[0]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[1]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[2]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[3]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[4]), mEntries [0]->mIterator.get(), mEntries[0]->mInfo.get()); } } while (0) |
| 652 | ("CacheFileContextEvictor::EvictEntries() - Processing hash. "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Processing hash. " "[hash=%08x%08x%08x%08x%08x, iterator=%p, info=%p]", PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[0]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[1]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[2]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[3]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[4]), mEntries [0]->mIterator.get(), mEntries[0]->mInfo.get()); } } while (0) |
| 653 | "[hash=%08x%08x%08x%08x%08x, iterator=%p, info=%p]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Processing hash. " "[hash=%08x%08x%08x%08x%08x, iterator=%p, info=%p]", PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[0]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[1]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[2]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[3]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[4]), mEntries [0]->mIterator.get(), mEntries[0]->mInfo.get()); } } while (0) |
| 654 | LOGSHA1(&hash), mEntries[0]->mIterator.get(),do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Processing hash. " "[hash=%08x%08x%08x%08x%08x, iterator=%p, info=%p]", PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[0]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[1]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[2]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[3]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[4]), mEntries [0]->mIterator.get(), mEntries[0]->mInfo.get()); } } while (0) |
| 655 | mEntries[0]->mInfo.get()))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Processing hash. " "[hash=%08x%08x%08x%08x%08x, iterator=%p, info=%p]", PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[0]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[1]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[2]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[3]), PR_htonl ((reinterpret_cast<const uint32_t*>(&hash))[4]), mEntries [0]->mIterator.get(), mEntries[0]->mInfo.get()); } } while (0); |
| 656 | |
| 657 | RefPtr<CacheFileHandle> handle; |
| 658 | CacheFileIOManager::gInstance->mHandles.GetHandle(&hash, |
| 659 | getter_AddRefs(handle)); |
| 660 | if (handle) { |
| 661 | // We doom any active handle in CacheFileIOManager::EvictByContext(), so |
| 662 | // this must be a new one. Skip it. |
| 663 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since we " "found an active handle. [handle=%p key=%s]", handle.get(), handle ->Key().get()); } } while (0) |
| 664 | ("CacheFileContextEvictor::EvictEntries() - Skipping entry since we "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since we " "found an active handle. [handle=%p key=%s]", handle.get(), handle ->Key().get()); } } while (0) |
| 665 | "found an active handle. [handle=%p key=%s]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since we " "found an active handle. [handle=%p key=%s]", handle.get(), handle ->Key().get()); } } while (0) |
| 666 | handle.get(), handle->Key().get()))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since we " "found an active handle. [handle=%p key=%s]", handle.get(), handle ->Key().get()); } } while (0); |
| 667 | continue; |
| 668 | } |
| 669 | |
| 670 | CacheIndex::EntryStatus status; |
| 671 | bool pinned = false; |
| 672 | auto callback = [&pinned](const CacheIndexEntry* aEntry) { |
| 673 | pinned = aEntry->IsPinned(); |
| 674 | }; |
| 675 | rv = CacheIndex::HasEntry(hash, &status, callback); |
| 676 | // This must never fail, since eviction (this code) happens only when the |
| 677 | // index is up-to-date and thus the information is known. |
| 678 | MOZ_ASSERT(NS_SUCCEEDED(rv))do { static_assert( mozilla::detail::AssertionConditionType< decltype(((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1) )))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1) ))))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1)))", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 678); AnnotateMozCrashReason("MOZ_ASSERT" "(" "((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1)))" ")"); do { MOZ_CrashSequence(__null, 678); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 679 | |
| 680 | if (pinned != mEntries[0]->mPinned) { |
| 681 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "pinning " "doesn't match [evicting pinned=%d, entry pinned=%d]" , mEntries[0]->mPinned, pinned); } } while (0) |
| 682 | ("CacheFileContextEvictor::EvictEntries() - Skipping entry since "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "pinning " "doesn't match [evicting pinned=%d, entry pinned=%d]" , mEntries[0]->mPinned, pinned); } } while (0) |
| 683 | "pinning "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "pinning " "doesn't match [evicting pinned=%d, entry pinned=%d]" , mEntries[0]->mPinned, pinned); } } while (0) |
| 684 | "doesn't match [evicting pinned=%d, entry pinned=%d]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "pinning " "doesn't match [evicting pinned=%d, entry pinned=%d]" , mEntries[0]->mPinned, pinned); } } while (0) |
| 685 | mEntries[0]->mPinned, pinned))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "pinning " "doesn't match [evicting pinned=%d, entry pinned=%d]" , mEntries[0]->mPinned, pinned); } } while (0); |
| 686 | continue; |
| 687 | } |
| 688 | |
| 689 | // Read metadata from the file synchronously |
| 690 | RefPtr<CacheFileMetadata> metadata = new CacheFileMetadata(); |
| 691 | { |
| 692 | // Get and read metadata for the entry |
| 693 | nsCOMPtr<nsIFile> file; |
| 694 | CacheFileIOManager::gInstance->GetFile(&hash, getter_AddRefs(file)); |
| 695 | |
| 696 | rv = metadata->SyncReadMetadata(file); |
| 697 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 697)) { |
| 698 | continue; |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | // Check whether we must filter by either base domain or by origin. |
| 703 | if (!mEntries[0]->mBaseDomain.IsEmpty() || |
| 704 | !mEntries[0]->mOrigin.IsEmpty()) { |
| 705 | // Now get the context + enhance id + URL from the key. |
| 706 | nsAutoCString uriSpec; |
| 707 | RefPtr<nsILoadContextInfo> info = |
| 708 | CacheFileUtils::ParseKey(metadata->GetKey(), nullptr, &uriSpec); |
| 709 | MOZ_ASSERT(info)do { static_assert( mozilla::detail::AssertionConditionType< decltype(info)>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(!!(info))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("info", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 709); AnnotateMozCrashReason("MOZ_ASSERT" "(" "info" ")"); do { MOZ_CrashSequence(__null, 709); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); |
| 710 | if (!info) { |
| 711 | continue; |
| 712 | } |
| 713 | |
| 714 | // Create URI from spec |
| 715 | nsCOMPtr<nsIURI> uri; |
| 716 | rv = NS_NewURI(getter_AddRefs(uri), uriSpec); |
| 717 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 718 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "NS_NewURI failed"); } } while (0) |
| 719 | ("CacheFileContextEvictor::EvictEntries() - Skipping entry since "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "NS_NewURI failed"); } } while (0) |
| 720 | "NS_NewURI failed"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "NS_NewURI failed"); } } while (0); |
| 721 | continue; |
| 722 | } |
| 723 | |
| 724 | if (!mEntries[0]->mBaseDomain.IsEmpty()) { |
| 725 | if (!tldService) { |
| 726 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Failed to get TLD " "service, skipping entry"); } } while (0) |
| 727 | ("CacheFileContextEvictor::EvictEntries() - Failed to get TLD "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Failed to get TLD " "service, skipping entry"); } } while (0) |
| 728 | "service, skipping entry"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Failed to get TLD " "service, skipping entry"); } } while (0); |
| 729 | continue; |
| 730 | } |
| 731 | |
| 732 | // 1. Check base domain match of the uri |
| 733 | nsAutoCString host; |
| 734 | rv = uri->GetHost(host); |
| 735 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0))) || host.IsEmpty()) { |
| 736 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Failed to get host, " "skipping entry"); } } while (0) |
| 737 | ("CacheFileContextEvictor::EvictEntries() - Failed to get host, "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Failed to get host, " "skipping entry"); } } while (0) |
| 738 | "skipping entry"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Failed to get host, " "skipping entry"); } } while (0); |
| 739 | continue; |
| 740 | } |
| 741 | |
| 742 | nsAutoCString baseDomainUTF8 = |
| 743 | NS_ConvertUTF16toUTF8(mEntries[0]->mBaseDomain); |
| 744 | bool hasRootDomain = false; |
| 745 | rv = tldService->HasRootDomain(host, baseDomainUTF8, &hasRootDomain); |
| 746 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 747 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Failed to check root " "domain, skipping entry"); } } while (0) |
| 748 | ("CacheFileContextEvictor::EvictEntries() - Failed to check root "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Failed to check root " "domain, skipping entry"); } } while (0) |
| 749 | "domain, skipping entry"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Failed to check root " "domain, skipping entry"); } } while (0); |
| 750 | continue; |
| 751 | } |
| 752 | |
| 753 | if (!hasRootDomain) { |
| 754 | MOZ_ASSERT(info && info->OriginAttributesPtr())do { static_assert( mozilla::detail::AssertionConditionType< decltype(info && info->OriginAttributesPtr())>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(info && info->OriginAttributesPtr()))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("info && info->OriginAttributesPtr()" , "./../../../netwerk/cache2/CacheFileContextEvictor.cpp", 754 ); AnnotateMozCrashReason("MOZ_ASSERT" "(" "info && info->OriginAttributesPtr()" ")"); do { MOZ_CrashSequence(__null, 754); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 755 | |
| 756 | // 2. If the entry's URI does not match, also check the partitionKey |
| 757 | // to also clear cache entries partitioned under base domain. |
| 758 | dom::PartitionKeyPatternDictionary partitionKeyPattern; |
| 759 | partitionKeyPattern.mBaseDomain.Construct(mEntries[0]->mBaseDomain); |
| 760 | OriginAttributesPattern originAttributesPattern; |
| 761 | originAttributesPattern.mPartitionKeyPattern.Construct( |
| 762 | partitionKeyPattern); |
| 763 | |
| 764 | if (!originAttributesPattern.Matches(*info->OriginAttributesPtr())) { |
| 765 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry " "since " "base domain does not match"); } } while (0) |
| 766 | ("CacheFileContextEvictor::EvictEntries() - Skipping entry "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry " "since " "base domain does not match"); } } while (0) |
| 767 | "since "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry " "since " "base domain does not match"); } } while (0) |
| 768 | "base domain does not match"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry " "since " "base domain does not match"); } } while (0); |
| 769 | continue; |
| 770 | } |
| 771 | } |
| 772 | |
| 773 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Entry matches base " "domain [spec=%s, baseDomain=%s]", uriSpec.get(), baseDomainUTF8 .get()); } } while (0) |
| 774 | ("CacheFileContextEvictor::EvictEntries() - Entry matches base "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Entry matches base " "domain [spec=%s, baseDomain=%s]", uriSpec.get(), baseDomainUTF8 .get()); } } while (0) |
| 775 | "domain [spec=%s, baseDomain=%s]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Entry matches base " "domain [spec=%s, baseDomain=%s]", uriSpec.get(), baseDomainUTF8 .get()); } } while (0) |
| 776 | uriSpec.get(), baseDomainUTF8.get()))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Entry matches base " "domain [spec=%s, baseDomain=%s]", uriSpec.get(), baseDomainUTF8 .get()); } } while (0); |
| 777 | } else { |
| 778 | // Check origin match |
| 779 | nsAutoString urlOrigin; |
| 780 | rv = nsContentUtils::GetWebExposedOriginSerialization(uri, urlOrigin); |
| 781 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 782 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "We failed to extract an origin"); } } while (0) |
| 783 | ("CacheFileContextEvictor::EvictEntries() - Skipping entry since "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "We failed to extract an origin"); } } while (0) |
| 784 | "We failed to extract an origin"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "We failed to extract an origin"); } } while (0); |
| 785 | continue; |
| 786 | } |
| 787 | |
| 788 | if (!urlOrigin.Equals(mEntries[0]->mOrigin)) { |
| 789 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "origin " "doesn't match"); } } while (0) |
| 790 | ("CacheFileContextEvictor::EvictEntries() - Skipping entry since "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "origin " "doesn't match"); } } while (0) |
| 791 | "origin "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "origin " "doesn't match"); } } while (0) |
| 792 | "doesn't match"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since " "origin " "doesn't match"); } } while (0); |
| 793 | continue; |
| 794 | } |
| 795 | } |
| 796 | } |
| 797 | |
| 798 | nsAutoCString leafName; |
| 799 | CacheFileIOManager::HashToStr(&hash, leafName); |
| 800 | |
| 801 | PRTime lastModifiedTime; |
| 802 | nsCOMPtr<nsIFile> file; |
| 803 | rv = mEntriesDir->Clone(getter_AddRefs(file)); |
| 804 | if (NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1)))) { |
| 805 | rv = file->AppendNative(leafName); |
| 806 | } |
| 807 | if (NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1)))) { |
| 808 | rv = file->GetLastModifiedTime(&lastModifiedTime); |
| 809 | } |
| 810 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 811 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Cannot get last modified " "time, skipping entry."); } } while (0) |
| 812 | ("CacheFileContextEvictor::EvictEntries() - Cannot get last modified "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Cannot get last modified " "time, skipping entry."); } } while (0) |
| 813 | "time, skipping entry."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Cannot get last modified " "time, skipping entry."); } } while (0); |
| 814 | continue; |
| 815 | } |
| 816 | |
| 817 | if (lastModifiedTime > mEntries[0]->mTimeStamp) { |
| 818 | LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping newer entry. " "[mTimeStamp=%" "l" "d" ", lastModifiedTime=%" "l" "d" "]", mEntries [0]->mTimeStamp, lastModifiedTime); } } while (0) |
| 819 | ("CacheFileContextEvictor::EvictEntries() - Skipping newer entry. "do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping newer entry. " "[mTimeStamp=%" "l" "d" ", lastModifiedTime=%" "l" "d" "]", mEntries [0]->mTimeStamp, lastModifiedTime); } } while (0) |
| 820 | "[mTimeStamp=%" PRId64 ", lastModifiedTime=%" PRId64 "]",do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping newer entry. " "[mTimeStamp=%" "l" "d" ", lastModifiedTime=%" "l" "d" "]", mEntries [0]->mTimeStamp, lastModifiedTime); } } while (0) |
| 821 | mEntries[0]->mTimeStamp, lastModifiedTime))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping newer entry. " "[mTimeStamp=%" "l" "d" ", lastModifiedTime=%" "l" "d" "]", mEntries [0]->mTimeStamp, lastModifiedTime); } } while (0); |
| 822 | continue; |
| 823 | } |
| 824 | |
| 825 | LOG(("CacheFileContextEvictor::EvictEntries - Removing entry."))do { const ::mozilla::LogModule* moz_real_module = gCache2Log ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries - Removing entry." ); } } while (0); |
| 826 | file->Remove(false); |
| 827 | CacheIndex::RemoveEntry(&hash, metadata->GetKey(), false); |
| 828 | } |
| 829 | |
| 830 | MOZ_ASSERT_UNREACHABLE("We should never get here")do { static_assert( mozilla::detail::AssertionConditionType< decltype(false)>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while ( false); MOZ_ReportAssertionFailure("false" " (" "MOZ_ASSERT_UNREACHABLE: " "We should never get here" ")", "./../../../netwerk/cache2/CacheFileContextEvictor.cpp" , 830); AnnotateMozCrashReason("MOZ_ASSERT" "(" "false" ") (" "MOZ_ASSERT_UNREACHABLE: " "We should never get here" ")"); do { MOZ_CrashSequence(__null, 830); __attribute__((nomerge)) :: abort(); } while (false); } } while (false); |
| 831 | } |
| 832 | |
| 833 | } // namespace mozilla::net |