Bug Summary

File:root/firefox-clang/obj-x86_64-pc-linux-gnu/netwerk/cache2/./../../../netwerk/cache2/CacheFileContextEvictor.cpp
Warning:line 358, column 5
Value stored to 'rv' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -O2 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name Unified_cpp_netwerk_cache20.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/netwerk/cache2 -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/netwerk/cache2 -resource-dir /usr/lib/llvm-23/lib/clang/23 -include /root/firefox-clang/config/gcc_hidden.h -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -D _GLIBCXX_ASSERTIONS=1 -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D DEBUG=1 -D MOZ_HAS_MOZGLUE -D MOZILLA_INTERNAL_API -D IMPL_LIBXUL -D MOZ_SUPPORT_LEAKCHECKING -D STATIC_EXPORTABLE_JS_API -I /root/firefox-clang/netwerk/cache2 -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/netwerk/cache2 -I /root/firefox-clang/netwerk/base -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders -I /root/firefox-clang/ipc/chromium/src -I /root/firefox-clang/third_party/abseil-cpp -I /root/firefox-clang/toolkit/components/telemetry -I /root/firefox-clang/xpcom/base -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/x86_64-linux-gnu/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/backward -internal-isystem /usr/lib/llvm-23/lib/clang/23/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-error=pessimizing-move -Wno-error=large-by-value-copy=128 -Wno-error=implicit-int-float-conversion -Wno-error=thread-safety-analysis -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -Wno-character-conversion -std=gnu++20 -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -fdiagnostics-absolute-paths -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -mllvm -dwarf-linkage-names=Abstract -faddrsig -fdwarf2-cfi-asm -o /tmp/scan-build-2026-09-01-224014-2642839-1 -x c++ Unified_cpp_netwerk_cache20.cpp
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 "nsContentUtils.h"
19#include "nsIDirectoryEnumerator.h"
20#include "nsIEffectiveTLDService.h"
21#include "nsIFile.h"
22#include "nsNetUtil.h"
23#include "nsString.h"
24#include "nsThreadUtils.h"
25
26namespace mozilla::net {
27
28#define CONTEXT_EVICTION_PREFIX"ce_" "ce_"
29const uint32_t kContextEvictionPrefixLength =
30 sizeof(CONTEXT_EVICTION_PREFIX"ce_") - 1;
31
32bool CacheFileContextEvictor::sDiskAlreadySearched = false;
33
34CacheFileContextEvictor::CacheFileContextEvictor() {
35 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)
;
36}
37
38CacheFileContextEvictor::~CacheFileContextEvictor() {
39 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)
;
40}
41
42nsresult CacheFileContextEvictor::Init(nsIFile* aCacheDirectory) {
43 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)
;
44
45 nsresult rv;
46
47 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"
, 47); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 47); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
48
49 CacheIndex::IsUpToDate(&mIndexIsUpToDate);
50
51 mCacheDirectory = aCacheDirectory;
52
53 rv = aCacheDirectory->Clone(getter_AddRefs(mEntriesDir));
54 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"
, 54)
) {
55 return rv;
56 }
57
58 rv = mEntriesDir->AppendNative(nsLiteralCString(ENTRIES_DIR"entries"));
59 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"
, 59)
) {
60 return rv;
61 }
62
63 if (!sDiskAlreadySearched) {
64 LoadEvictInfoFromDisk();
65 if ((mEntries.Length() != 0) && mIndexIsUpToDate) {
66 CreateIterators();
67 StartEvicting();
68 }
69 }
70
71 return NS_OK;
72}
73
74void CacheFileContextEvictor::Shutdown() {
75 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)
;
76
77 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"
, 77); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 77); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
78
79 CloseIterators();
80}
81
82uint32_t CacheFileContextEvictor::ContextsCount() {
83 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"
, 83); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 83); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
84
85 return mEntries.Length();
86}
87
88nsresult CacheFileContextEvictor::AddContext(
89 nsILoadContextInfo* aLoadContextInfo, bool aPinned,
90 const nsAString& aOrigin, const nsAString& aBaseDomain) {
91 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
)
92 ("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
)
93 "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
)
94 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
)
;
95
96 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"
, 97); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aOrigin.IsEmpty() || aBaseDomain.IsEmpty()"
") (" "Cannot specify both origin and base domain" ")"); do {
MOZ_CrashSequence(__null, 97); __attribute__((nomerge)) ::abort
(); } while (false); } } while (false)
97 "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"
, 97); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aOrigin.IsEmpty() || aBaseDomain.IsEmpty()"
") (" "Cannot specify both origin and base domain" ")"); do {
MOZ_CrashSequence(__null, 97); __attribute__((nomerge)) ::abort
(); } while (false); } } while (false)
;
98
99 nsresult rv;
100
101 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"
, 101); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 101); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
102
103 CacheFileContextEvictorEntry* entry = nullptr;
104 if (aLoadContextInfo) {
105 for (uint32_t i = 0; i < mEntries.Length(); ++i) {
106 if (mEntries[i]->mInfo && mEntries[i]->mInfo->Equals(aLoadContextInfo) &&
107 mEntries[i]->mPinned == aPinned &&
108 (mEntries[i]->mOrigin.Equals(aOrigin) ||
109 mEntries[i]->mBaseDomain.Equals(aBaseDomain))) {
110 entry = mEntries[i].get();
111 break;
112 }
113 }
114 } else {
115 // Not providing load context info means we want to delete everything,
116 // so let's not bother with any currently running context cleanups
117 // for the same pinning state.
118 for (uint32_t i = mEntries.Length(); i > 0;) {
119 --i;
120 if (mEntries[i]->mInfo && mEntries[i]->mPinned == aPinned) {
121 RemoveEvictInfoFromDisk(mEntries[i]->mInfo, mEntries[i]->mPinned,
122 mEntries[i]->mOrigin, mEntries[i]->mBaseDomain);
123 mEntries.RemoveElementAt(i);
124 }
125 }
126 }
127
128 if (!entry) {
129 entry = new CacheFileContextEvictorEntry();
130 entry->mInfo = aLoadContextInfo;
131 entry->mPinned = aPinned;
132 entry->mOrigin = aOrigin;
133 entry->mBaseDomain = aBaseDomain;
134 mEntries.AppendElement(WrapUnique(entry));
135 }
136
137 entry->mTimeStamp = PR_Now() / PR_USEC_PER_MSEC1000L;
138
139 PersistEvictionInfoToDisk(aLoadContextInfo, aPinned, aOrigin, aBaseDomain);
140
141 if (mIndexIsUpToDate) {
142 // Already existing context could be added again, in this case the iterator
143 // would be recreated. Close the old iterator explicitely.
144 if (entry->mIterator) {
145 entry->mIterator->Close();
146 entry->mIterator = nullptr;
147 }
148
149 rv = CacheIndex::GetIterator(aLoadContextInfo, false,
150 getter_AddRefs(entry->mIterator));
151 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
152 // This could probably happen during shutdown. Remove the entry from
153 // the array, but leave the info on the disk. No entry can be opened
154 // during shutdown and we'll load the eviction info on next start.
155 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)
156 ("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)
157 "[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)
158 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)
;
159 mEntries.RemoveElement(entry);
160 return rv;
161 }
162
163 StartEvicting();
164 }
165
166 return NS_OK;
167}
168
169void CacheFileContextEvictor::CacheIndexStateChanged() {
170 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)
;
171
172 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"
, 172); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 172); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
173
174 bool isUpToDate = false;
175 CacheIndex::IsUpToDate(&isUpToDate);
176 if (mEntries.Length() == 0) {
177 // Just save the state and exit, since there is nothing to do
178 mIndexIsUpToDate = isUpToDate;
179 return;
180 }
181
182 if (!isUpToDate && !mIndexIsUpToDate) {
183 // Index is outdated and status has not changed, nothing to do.
184 return;
185 }
186
187 if (isUpToDate && mIndexIsUpToDate) {
188 // Status has not changed, but make sure the eviction is running.
189 if (mEvicting) {
190 return;
191 }
192
193 // We're not evicting, but we should be evicting?!
194 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)
195 ("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)
196 "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)
197 "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)
;
198 }
199
200 mIndexIsUpToDate = isUpToDate;
201
202 if (mIndexIsUpToDate) {
203 CreateIterators();
204 StartEvicting();
205 } else {
206 CloseIterators();
207 }
208}
209
210void CacheFileContextEvictor::WasEvicted(const nsACString& aKey, nsIFile* aFile,
211 bool* aEvictedAsPinned,
212 bool* aEvictedAsNonPinned) {
213 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)
214 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)
;
215
216 *aEvictedAsPinned = false;
217 *aEvictedAsNonPinned = false;
218
219 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"
, 219); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 219); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
220
221 nsCOMPtr<nsILoadContextInfo> info = CacheFileUtils::ParseKey(aKey);
222 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"
, 222); AnnotateMozCrashReason("MOZ_ASSERT" "(" "info" ")"); do
{ MOZ_CrashSequence(__null, 222); __attribute__((nomerge)) ::
abort(); } while (false); } } while (false)
;
223 if (!info) {
224 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)
;
225 return;
226 }
227
228 for (uint32_t i = 0; i < mEntries.Length(); ++i) {
229 const auto& entry = mEntries[i];
230
231 if (entry->mInfo && !info->Equals(entry->mInfo)) {
232 continue;
233 }
234
235 PRTime lastModifiedTime;
236 if (NS_FAILED(aFile->GetLastModifiedTime(&lastModifiedTime))((bool)(__builtin_expect(!!(NS_FAILED_impl(aFile->GetLastModifiedTime
(&lastModifiedTime))), 0)))
) {
237 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)
238 ("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)
239 "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)
;
240 return;
241 }
242
243 if (lastModifiedTime > entry->mTimeStamp) {
244 // File has been modified since context eviction.
245 continue;
246 }
247
248 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)
249 ("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)
250 "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)
251 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)
;
252
253 if (entry->mPinned) {
254 *aEvictedAsPinned = true;
255 } else {
256 *aEvictedAsNonPinned = true;
257 }
258 }
259}
260
261nsresult CacheFileContextEvictor::PersistEvictionInfoToDisk(
262 nsILoadContextInfo* aLoadContextInfo, bool aPinned,
263 const nsAString& aOrigin, const nsAString& aBaseDomain) {
264 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
)
265 ("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
)
266 "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
)
267 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
)
;
268
269 nsresult rv;
270
271 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"
, 271); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 271); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
272
273 nsCOMPtr<nsIFile> file;
274 rv = GetContextFile(aLoadContextInfo, aPinned, aOrigin, aBaseDomain,
275 getter_AddRefs(file));
276 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"
, 276)
) {
277 return rv;
278 }
279
280 nsCString path = file->HumanReadablePath();
281
282 PRFileDesc* fd;
283 rv =
284 file->OpenNSPRFileDesc(PR_RDWR0x04 | PR_CREATE_FILE0x08 | PR_TRUNCATE0x20, 0600, &fd);
285 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"
, 285)
) {
286 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)
287 ("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)
288 "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)
289 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)
;
290 return rv;
291 }
292
293 PR_Close(fd);
294
295 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)
296 ("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)
297 "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)
298 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)
;
299
300 return NS_OK;
301}
302
303nsresult CacheFileContextEvictor::RemoveEvictInfoFromDisk(
304 nsILoadContextInfo* aLoadContextInfo, bool aPinned,
305 const nsAString& aOrigin, const nsAString& aBaseDomain) {
306 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
)
307 ("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
)
308 "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
)
309 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
)
;
310
311 nsresult rv;
312
313 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"
, 313); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 313); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
314
315 nsCOMPtr<nsIFile> file;
316 rv = GetContextFile(aLoadContextInfo, aPinned, aOrigin, aBaseDomain,
317 getter_AddRefs(file));
318 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"
, 318)
) {
319 return rv;
320 }
321
322 nsCString path = file->HumanReadablePath();
323
324 rv = file->Remove(false);
325 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"
, 325)
) {
326 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)
327 ("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)
328 " 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)
329 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)
;
330 return rv;
331 }
332
333 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)
334 ("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)
335 "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)
336 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)
;
337
338 return NS_OK;
339}
340
341nsresult CacheFileContextEvictor::LoadEvictInfoFromDisk() {
342 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)
;
343
344 nsresult rv;
345
346 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"
, 346); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 346); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
347
348 sDiskAlreadySearched = true;
349
350 nsCOMPtr<nsIDirectoryEnumerator> dirEnum;
351 rv = mCacheDirectory->GetDirectoryEntries(getter_AddRefs(dirEnum));
352 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"
, 352)
) {
353 return rv;
354 }
355
356 while (true) {
357 nsCOMPtr<nsIFile> file;
358 rv = dirEnum->GetNextFile(getter_AddRefs(file));
Value stored to 'rv' is never read
359 if (!file) {
360 break;
361 }
362
363 bool isDir = false;
364 file->IsDirectory(&isDir);
365 if (isDir) {
366 continue;
367 }
368
369 nsAutoCString leaf;
370 rv = file->GetNativeLeafName(leaf);
371 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
372 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)
373 ("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)
374 "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)
;
375 continue;
376 }
377
378 if (leaf.Length() < kContextEvictionPrefixLength) {
379 continue;
380 }
381
382 if (!StringBeginsWith(leaf, nsLiteralCString(CONTEXT_EVICTION_PREFIX"ce_"))) {
383 continue;
384 }
385
386 nsAutoCString encoded;
387 encoded = Substring(leaf, kContextEvictionPrefixLength);
388 encoded.ReplaceChar('-', '/');
389
390 nsAutoCString decoded;
391 rv = Base64Decode(encoded, decoded);
392 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
393 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)
394 ("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)
395 "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)
396 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)
;
397 file->Remove(false);
398 continue;
399 }
400
401 bool pinned = decoded[0] == '\t';
402 if (pinned) {
403 decoded = Substring(decoded, 1);
404 }
405
406 nsAutoCString origin;
407 nsAutoCString baseDomain;
408 if (decoded.Contains('\t')) {
409 auto split = decoded.Split('\t');
410 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"
, 410); AnnotateMozCrashReason("MOZ_ASSERT" "(" "decoded.CountChar('\\t') == 1"
")"); do { MOZ_CrashSequence(__null, 410); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
411
412 auto splitIt = split.begin();
413 nsAutoCString value(*splitIt);
414 ++splitIt;
415 decoded = *splitIt;
416
417 // Check if this is a base domain entry (prefixed with 's:')
418 if (StringBeginsWith(value, "s:"_ns)) {
419 baseDomain = nsAutoCString(Substring(value, 2));
420 } else {
421 origin = value;
422 }
423 }
424
425 nsCOMPtr<nsILoadContextInfo> info;
426 if (!"*"_ns.Equals(decoded)) {
427 // "*" is indication of 'delete all', info left null will pass
428 // to CacheFileContextEvictor::AddContext and clear all the cache data.
429 info = CacheFileUtils::ParseKey(decoded);
430 if (!info) {
431 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)
432 ("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)
433 "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)
434 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)
;
435 file->Remove(false);
436 continue;
437 }
438 }
439
440 PRTime lastModifiedTime;
441 rv = file->GetLastModifiedTime(&lastModifiedTime);
442 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
443 continue;
444 }
445
446 auto entry = MakeUnique<CacheFileContextEvictorEntry>();
447 entry->mInfo = std::move(info);
448 entry->mPinned = pinned;
449 CopyUTF8toUTF16(origin, entry->mOrigin);
450 CopyUTF8toUTF16(baseDomain, entry->mBaseDomain);
451 entry->mTimeStamp = lastModifiedTime;
452 mEntries.AppendElement(std::move(entry));
453 }
454
455 return NS_OK;
456}
457
458nsresult CacheFileContextEvictor::GetContextFile(
459 nsILoadContextInfo* aLoadContextInfo, bool aPinned,
460 const nsAString& aOrigin, const nsAString& aBaseDomain, nsIFile** _retval) {
461 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"
, 462); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aOrigin.IsEmpty() || aBaseDomain.IsEmpty()"
") (" "Cannot specify both origin and base domain" ")"); do {
MOZ_CrashSequence(__null, 462); __attribute__((nomerge)) ::abort
(); } while (false); } } while (false)
462 "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"
, 462); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aOrigin.IsEmpty() || aBaseDomain.IsEmpty()"
") (" "Cannot specify both origin and base domain" ")"); do {
MOZ_CrashSequence(__null, 462); __attribute__((nomerge)) ::abort
(); } while (false); } } while (false)
;
463 nsresult rv;
464
465 nsAutoCString keyPrefix;
466 if (aPinned) {
467 // Mark pinned context files with a tab char at the start.
468 // Tab is chosen because it can never be used as a context key tag.
469 keyPrefix.Append('\t');
470 }
471 if (aLoadContextInfo) {
472 CacheFileUtils::AppendKeyPrefix(aLoadContextInfo, keyPrefix);
473 } else {
474 keyPrefix.Append('*');
475 }
476
477 if (!aOrigin.IsEmpty()) {
478 keyPrefix.Append('\t');
479 keyPrefix.Append(NS_ConvertUTF16toUTF8(aOrigin));
480 } else if (!aBaseDomain.IsEmpty()) {
481 keyPrefix.Append('\t');
482 keyPrefix.AppendLiteral("s:"); // Prefix to identify base domain entries
483 keyPrefix.Append(NS_ConvertUTF16toUTF8(aBaseDomain));
484 }
485
486 nsAutoCString leafName;
487 leafName.AssignLiteral(CONTEXT_EVICTION_PREFIX"ce_");
488
489 rv = Base64EncodeAppend(keyPrefix, leafName);
490 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"
, 490)
) {
491 return rv;
492 }
493
494 // Replace '/' with '-' since '/' cannot be part of the filename.
495 leafName.ReplaceChar('/', '-');
496
497 nsCOMPtr<nsIFile> file;
498 rv = mCacheDirectory->Clone(getter_AddRefs(file));
499 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"
, 499)
) {
500 return rv;
501 }
502
503 rv = file->AppendNative(leafName);
504 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"
, 504)
) {
505 return rv;
506 }
507
508 file.swap(*_retval);
509 return NS_OK;
510}
511
512void CacheFileContextEvictor::CreateIterators() {
513 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)
;
514
515 CloseIterators();
516
517 nsresult rv;
518
519 for (uint32_t i = 0; i < mEntries.Length();) {
520 rv = CacheIndex::GetIterator(mEntries[i]->mInfo, false,
521 getter_AddRefs(mEntries[i]->mIterator));
522 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
523 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)
524 ("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)
525 ". [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)
526 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)
;
527 mEntries.RemoveElementAt(i);
528 continue;
529 }
530
531 ++i;
532 }
533}
534
535void CacheFileContextEvictor::CloseIterators() {
536 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)
;
537
538 for (uint32_t i = 0; i < mEntries.Length(); ++i) {
539 if (mEntries[i]->mIterator) {
540 mEntries[i]->mIterator->Close();
541 mEntries[i]->mIterator = nullptr;
542 }
543 }
544}
545
546void CacheFileContextEvictor::StartEvicting() {
547 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)
;
548
549 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"
, 549); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 549); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
550
551 if (mEvicting) {
552 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)
;
553 return;
554 }
555
556 if (mEntries.Length() == 0) {
557 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)
;
558 return;
559 }
560
561 nsCOMPtr<nsIRunnable> ev =
562 NewRunnableMethod("net::CacheFileContextEvictor::EvictEntries", this,
563 &CacheFileContextEvictor::EvictEntries);
564
565 RefPtr<CacheIOThread> ioThread = CacheFileIOManager::IOThread();
566
567 nsresult rv = ioThread->Dispatch(ev, CacheIOThread::EVICT);
568 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
569 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)
570 ("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)
571 "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)
572 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)
;
573 }
574
575 mEvicting = true;
576}
577
578void CacheFileContextEvictor::EvictEntries() {
579 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)
;
580
581 nsresult rv;
582
583 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"
, 583); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { MOZ_CrashSequence(__null, 583); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
584
585 mEvicting = false;
586
587 if (!mIndexIsUpToDate) {
588 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)
589 ("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)
590 "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)
;
591 return;
592 }
593
594 nsCOMPtr<nsIEffectiveTLDService> tldService =
595 mozilla::components::EffectiveTLD::Service();
596 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"
, 596); AnnotateMozCrashReason("MOZ_ASSERT" "(" "tldService" ")"
); do { MOZ_CrashSequence(__null, 596); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
597
598 while (true) {
599 if (CacheObserver::ShuttingDown()) {
600 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)
601 ("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)
602 "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)
;
603 mEvicting =
604 true; // We don't want to start eviction again during shutdown
605 // process. Setting this flag to true ensures it.
606 return;
607 }
608
609 if (CacheIOThread::YieldAndRerun()) {
610 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)
611 ("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)
612 "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)
;
613 mEvicting = true;
614 return;
615 }
616
617 if (mEntries.Length() == 0) {
618 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)
619 ("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)
620 "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)
;
621
622 // Allow index to notify AsyncGetDiskConsumption callbacks. The size is
623 // actual again.
624 CacheIndex::OnAsyncEviction(false);
625 return;
626 }
627
628 SHA1Sum::Hash hash;
629 rv = mEntries[0]->mIterator->GetNextHash(&hash);
630 if (rv == NS_ERROR_NOT_AVAILABLE) {
631 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)
632 ("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)
633 "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)
634 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)
;
635 RemoveEvictInfoFromDisk(mEntries[0]->mInfo, mEntries[0]->mPinned,
636 mEntries[0]->mOrigin, mEntries[0]->mBaseDomain);
637 mEntries.RemoveElementAt(0);
638 continue;
639 }
640 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
641 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)
642 ("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)
643 "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)
644 " [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)
645 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)
;
646 mEntries.RemoveElementAt(0);
647 continue;
648 }
649
650 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)
651 ("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)
652 "[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)
653 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)
654 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)
;
655
656 RefPtr<CacheFileHandle> handle;
657 CacheFileIOManager::gInstance->mHandles.GetHandle(&hash,
658 getter_AddRefs(handle));
659 if (handle) {
660 // We doom any active handle in CacheFileIOManager::EvictByContext(), so
661 // this must be a new one. Skip it.
662 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)
663 ("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)
664 "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)
665 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)
;
666 continue;
667 }
668
669 CacheIndex::EntryStatus status;
670 bool pinned = false;
671 auto callback = [&pinned](const CacheIndexEntry* aEntry) {
672 pinned = aEntry->IsPinned();
673 };
674 rv = CacheIndex::HasEntry(hash, &status, callback);
675 // This must never fail, since eviction (this code) happens only when the
676 // index is up-to-date and thus the information is known.
677 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"
, 677); AnnotateMozCrashReason("MOZ_ASSERT" "(" "((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1)))"
")"); do { MOZ_CrashSequence(__null, 677); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
678
679 if (pinned != mEntries[0]->mPinned) {
680 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)
681 ("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)
682 "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)
683 "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)
684 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)
;
685 continue;
686 }
687
688 // Read metadata from the file synchronously
689 RefPtr<CacheFileMetadata> metadata = new CacheFileMetadata();
690 {
691 // Get and read metadata for the entry
692 nsCOMPtr<nsIFile> file;
693 CacheFileIOManager::gInstance->GetFile(&hash, getter_AddRefs(file));
694
695 rv = metadata->SyncReadMetadata(file);
696 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"
, 696)
) {
697 continue;
698 }
699 }
700
701 // Check whether we must filter by either base domain or by origin.
702 if (!mEntries[0]->mBaseDomain.IsEmpty() ||
703 !mEntries[0]->mOrigin.IsEmpty()) {
704 // Now get the context + enhance id + URL from the key.
705 nsAutoCString uriSpec;
706 RefPtr<nsILoadContextInfo> info =
707 CacheFileUtils::ParseKey(metadata->GetKey(), nullptr, &uriSpec);
708 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"
, 708); AnnotateMozCrashReason("MOZ_ASSERT" "(" "info" ")"); do
{ MOZ_CrashSequence(__null, 708); __attribute__((nomerge)) ::
abort(); } while (false); } } while (false)
;
709 if (!info) {
710 continue;
711 }
712
713 // Create URI from spec
714 nsCOMPtr<nsIURI> uri;
715 rv = NS_NewURI(getter_AddRefs(uri), uriSpec);
716 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
717 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)
718 ("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)
719 "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)
;
720 continue;
721 }
722
723 if (!mEntries[0]->mBaseDomain.IsEmpty()) {
724 if (!tldService) {
725 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)
726 ("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)
727 "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)
;
728 continue;
729 }
730
731 // 1. Check base domain match of the uri
732 nsAutoCString host;
733 rv = uri->GetHost(host);
734 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0))) || host.IsEmpty()) {
735 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)
736 ("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)
737 "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)
;
738 continue;
739 }
740
741 nsAutoCString baseDomainUTF8 =
742 NS_ConvertUTF16toUTF8(mEntries[0]->mBaseDomain);
743 bool hasRootDomain = false;
744 rv = tldService->HasRootDomain(host, baseDomainUTF8, &hasRootDomain);
745 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
746 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)
747 ("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)
748 "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)
;
749 continue;
750 }
751
752 if (!hasRootDomain) {
753 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", 753
); AnnotateMozCrashReason("MOZ_ASSERT" "(" "info && info->OriginAttributesPtr()"
")"); do { MOZ_CrashSequence(__null, 753); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
754
755 // 2. If the entry's URI does not match, also check the partitionKey
756 // to also clear cache entries partitioned under base domain.
757 dom::PartitionKeyPatternDictionary partitionKeyPattern;
758 partitionKeyPattern.mBaseDomain.Construct(mEntries[0]->mBaseDomain);
759 OriginAttributesPattern originAttributesPattern;
760 originAttributesPattern.mPartitionKeyPattern.Construct(
761 partitionKeyPattern);
762
763 if (!originAttributesPattern.Matches(*info->OriginAttributesPtr())) {
764 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)
765 ("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)
766 "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)
767 "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)
;
768 continue;
769 }
770 }
771
772 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)
773 ("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)
774 "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)
775 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)
;
776 } else {
777 // Check origin match
778 nsAutoString urlOrigin;
779 rv = nsContentUtils::GetWebExposedOriginSerialization(uri, urlOrigin);
780 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
781 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)
782 ("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)
783 "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)
;
784 continue;
785 }
786
787 if (!urlOrigin.Equals(mEntries[0]->mOrigin)) {
788 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)
789 ("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)
790 "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)
791 "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)
;
792 continue;
793 }
794 }
795 }
796
797 nsAutoCString leafName;
798 CacheFileIOManager::HashToStr(&hash, leafName);
799
800 PRTime lastModifiedTime;
801 nsCOMPtr<nsIFile> file;
802 rv = mEntriesDir->Clone(getter_AddRefs(file));
803 if (NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1)))) {
804 rv = file->AppendNative(leafName);
805 }
806 if (NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1)))) {
807 rv = file->GetLastModifiedTime(&lastModifiedTime);
808 }
809 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
810 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)
811 ("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)
812 "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)
;
813 continue;
814 }
815
816 if (lastModifiedTime > mEntries[0]->mTimeStamp) {
817 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)
818 ("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)
819 "[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)
820 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)
;
821 continue;
822 }
823
824 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)
;
825 file->Remove(false);
826 CacheIndex::RemoveEntry(&hash, metadata->GetKey(), false);
827 }
828
829 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"
, 829); AnnotateMozCrashReason("MOZ_ASSERT" "(" "false" ") ("
"MOZ_ASSERT_UNREACHABLE: " "We should never get here" ")"); do
{ MOZ_CrashSequence(__null, 829); __attribute__((nomerge)) ::
abort(); } while (false); } } while (false)
;
830}
831
832} // namespace mozilla::net