Bug Summary

File:var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp
Warning:line 348, 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 -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=/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/netwerk/cache2 -fcoverage-compilation-dir=/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/netwerk/cache2 -resource-dir /usr/lib/llvm-18/lib/clang/18 -include /var/lib/jenkins/workspace/firefox-scan-build/config/gcc_hidden.h -include /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/mozilla-config.h -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -I /var/lib/jenkins/workspace/firefox-scan-build/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 STATIC_EXPORTABLE_JS_API -I /var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2 -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/netwerk/cache2 -I /var/lib/jenkins/workspace/firefox-scan-build/netwerk/base -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders -I /var/lib/jenkins/workspace/firefox-scan-build/ipc/chromium/src -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/x86_64-linux-gnu/c++/13 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/backward -internal-isystem /usr/lib/llvm-18/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -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-deprecated-this-capture -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 -fdeprecated-macro -ferror-limit 19 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fno-aligned-allocation -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2024-05-16-034744-15991-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 "CacheLog.h"
6#include "CacheFileContextEvictor.h"
7#include "CacheFileIOManager.h"
8#include "CacheFileMetadata.h"
9#include "CacheIndex.h"
10#include "CacheIndexIterator.h"
11#include "CacheFileUtils.h"
12#include "CacheObserver.h"
13#include "nsIFile.h"
14#include "LoadContextInfo.h"
15#include "nsThreadUtils.h"
16#include "nsString.h"
17#include "nsIDirectoryEnumerator.h"
18#include "mozilla/Base64.h"
19#include "mozilla/IntegerPrintfMacros.h"
20#include "nsContentUtils.h"
21#include "nsNetUtil.h"
22
23namespace mozilla::net {
24
25#define CONTEXT_EVICTION_PREFIX"ce_" "ce_"
26const uint32_t kContextEvictionPrefixLength =
27 sizeof(CONTEXT_EVICTION_PREFIX"ce_") - 1;
28
29bool CacheFileContextEvictor::sDiskAlreadySearched = false;
30
31CacheFileContextEvictor::CacheFileContextEvictor() {
32 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)
;
33}
34
35CacheFileContextEvictor::~CacheFileContextEvictor() {
36 LOG(("CacheFileContextEvictor::~CacheFileContextEvictor() [this=%p]", this))do { const ::mozilla::LogModule* moz_real_module = gCache2Log
; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module
, mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print
(moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::~CacheFileContextEvictor() [this=%p]"
, this); } } while (0)
;
37}
38
39nsresult CacheFileContextEvictor::Init(nsIFile* aCacheDirectory) {
40 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)
;
41
42 nsresult rv;
43
44 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 44); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 44; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
45
46 CacheIndex::IsUpToDate(&mIndexIsUpToDate);
47
48 mCacheDirectory = aCacheDirectory;
49
50 rv = aCacheDirectory->Clone(getter_AddRefs(mEntriesDir));
51 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 51)
) {
52 return rv;
53 }
54
55 rv = mEntriesDir->AppendNative(nsLiteralCString(ENTRIES_DIR"entries"));
56 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 56)
) {
57 return rv;
58 }
59
60 if (!sDiskAlreadySearched) {
61 LoadEvictInfoFromDisk();
62 if ((mEntries.Length() != 0) && mIndexIsUpToDate) {
63 CreateIterators();
64 StartEvicting();
65 }
66 }
67
68 return NS_OK;
69}
70
71void CacheFileContextEvictor::Shutdown() {
72 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)
;
73
74 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 74); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 74; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
75
76 CloseIterators();
77}
78
79uint32_t CacheFileContextEvictor::ContextsCount() {
80 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 80); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 80; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
81
82 return mEntries.Length();
83}
84
85nsresult CacheFileContextEvictor::AddContext(
86 nsILoadContextInfo* aLoadContextInfo, bool aPinned,
87 const nsAString& aOrigin) {
88 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
)
89 ("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
)
90 "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
)
91 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
)
;
92
93 nsresult rv;
94
95 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 95); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 95; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
96
97 CacheFileContextEvictorEntry* entry = nullptr;
98 if (aLoadContextInfo) {
99 for (uint32_t i = 0; i < mEntries.Length(); ++i) {
100 if (mEntries[i]->mInfo && mEntries[i]->mInfo->Equals(aLoadContextInfo) &&
101 mEntries[i]->mPinned == aPinned &&
102 mEntries[i]->mOrigin.Equals(aOrigin)) {
103 entry = mEntries[i].get();
104 break;
105 }
106 }
107 } else {
108 // Not providing load context info means we want to delete everything,
109 // so let's not bother with any currently running context cleanups
110 // for the same pinning state.
111 for (uint32_t i = mEntries.Length(); i > 0;) {
112 --i;
113 if (mEntries[i]->mInfo && mEntries[i]->mPinned == aPinned) {
114 RemoveEvictInfoFromDisk(mEntries[i]->mInfo, mEntries[i]->mPinned,
115 mEntries[i]->mOrigin);
116 mEntries.RemoveElementAt(i);
117 }
118 }
119 }
120
121 if (!entry) {
122 entry = new CacheFileContextEvictorEntry();
123 entry->mInfo = aLoadContextInfo;
124 entry->mPinned = aPinned;
125 entry->mOrigin = aOrigin;
126 mEntries.AppendElement(WrapUnique(entry));
127 }
128
129 entry->mTimeStamp = PR_Now() / PR_USEC_PER_MSEC1000L;
130
131 PersistEvictionInfoToDisk(aLoadContextInfo, aPinned, aOrigin);
132
133 if (mIndexIsUpToDate) {
134 // Already existing context could be added again, in this case the iterator
135 // would be recreated. Close the old iterator explicitely.
136 if (entry->mIterator) {
137 entry->mIterator->Close();
138 entry->mIterator = nullptr;
139 }
140
141 rv = CacheIndex::GetIterator(aLoadContextInfo, false,
142 getter_AddRefs(entry->mIterator));
143 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
144 // This could probably happen during shutdown. Remove the entry from
145 // the array, but leave the info on the disk. No entry can be opened
146 // during shutdown and we'll load the eviction info on next start.
147 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)
148 ("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)
149 "[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)
150 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)
;
151 mEntries.RemoveElement(entry);
152 return rv;
153 }
154
155 StartEvicting();
156 }
157
158 return NS_OK;
159}
160
161void CacheFileContextEvictor::CacheIndexStateChanged() {
162 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)
;
163
164 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 164); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 164; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
165
166 bool isUpToDate = false;
167 CacheIndex::IsUpToDate(&isUpToDate);
168 if (mEntries.Length() == 0) {
169 // Just save the state and exit, since there is nothing to do
170 mIndexIsUpToDate = isUpToDate;
171 return;
172 }
173
174 if (!isUpToDate && !mIndexIsUpToDate) {
175 // Index is outdated and status has not changed, nothing to do.
176 return;
177 }
178
179 if (isUpToDate && mIndexIsUpToDate) {
180 // Status has not changed, but make sure the eviction is running.
181 if (mEvicting) {
182 return;
183 }
184
185 // We're not evicting, but we should be evicting?!
186 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)
187 ("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)
188 "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)
189 "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)
;
190 }
191
192 mIndexIsUpToDate = isUpToDate;
193
194 if (mIndexIsUpToDate) {
195 CreateIterators();
196 StartEvicting();
197 } else {
198 CloseIterators();
199 }
200}
201
202void CacheFileContextEvictor::WasEvicted(const nsACString& aKey, nsIFile* aFile,
203 bool* aEvictedAsPinned,
204 bool* aEvictedAsNonPinned) {
205 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)
206 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)
;
207
208 *aEvictedAsPinned = false;
209 *aEvictedAsNonPinned = false;
210
211 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 211); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 211; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
212
213 nsCOMPtr<nsILoadContextInfo> info = CacheFileUtils::ParseKey(aKey);
214 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", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 214); AnnotateMozCrashReason("MOZ_ASSERT" "(" "info" ")"); do
{ *((volatile int*)__null) = 214; __attribute__((nomerge)) ::
abort(); } while (false); } } while (false)
;
215 if (!info) {
216 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)
;
217 return;
218 }
219
220 for (uint32_t i = 0; i < mEntries.Length(); ++i) {
221 const auto& entry = mEntries[i];
222
223 if (entry->mInfo && !info->Equals(entry->mInfo)) {
224 continue;
225 }
226
227 PRTime lastModifiedTime;
228 if (NS_FAILED(aFile->GetLastModifiedTime(&lastModifiedTime))((bool)(__builtin_expect(!!(NS_FAILED_impl(aFile->GetLastModifiedTime
(&lastModifiedTime))), 0)))
) {
229 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)
230 ("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)
231 "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)
;
232 return;
233 }
234
235 if (lastModifiedTime > entry->mTimeStamp) {
236 // File has been modified since context eviction.
237 continue;
238 }
239
240 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)
241 ("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)
242 "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)
243 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)
;
244
245 if (entry->mPinned) {
246 *aEvictedAsPinned = true;
247 } else {
248 *aEvictedAsNonPinned = true;
249 }
250 }
251}
252
253nsresult CacheFileContextEvictor::PersistEvictionInfoToDisk(
254 nsILoadContextInfo* aLoadContextInfo, bool aPinned,
255 const nsAString& aOrigin) {
256 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
)
257 ("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
)
258 "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
)
259 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
)
;
260
261 nsresult rv;
262
263 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 263); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 263; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
264
265 nsCOMPtr<nsIFile> file;
266 rv = GetContextFile(aLoadContextInfo, aPinned, aOrigin, getter_AddRefs(file));
267 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 267)
) {
268 return rv;
269 }
270
271 nsCString path = file->HumanReadablePath();
272
273 PRFileDesc* fd;
274 rv =
275 file->OpenNSPRFileDesc(PR_RDWR0x04 | PR_CREATE_FILE0x08 | PR_TRUNCATE0x20, 0600, &fd);
276 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 276)
) {
277 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)
278 ("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)
279 "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)
280 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)
;
281 return rv;
282 }
283
284 PR_Close(fd);
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() - Successfully "
"created file. [path=%s]", path.get()); } } while (0)
287 ("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)
288 "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)
289 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)
;
290
291 return NS_OK;
292}
293
294nsresult CacheFileContextEvictor::RemoveEvictInfoFromDisk(
295 nsILoadContextInfo* aLoadContextInfo, bool aPinned,
296 const nsAString& aOrigin) {
297 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
)
298 ("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
)
299 "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
)
300 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
)
;
301
302 nsresult rv;
303
304 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 304); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 304; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
305
306 nsCOMPtr<nsIFile> file;
307 rv = GetContextFile(aLoadContextInfo, aPinned, aOrigin, getter_AddRefs(file));
308 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 308)
) {
309 return rv;
310 }
311
312 nsCString path = file->HumanReadablePath();
313
314 rv = file->Remove(false);
315 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 315)
) {
316 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)
317 ("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)
318 " 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)
319 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)
;
320 return rv;
321 }
322
323 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)
324 ("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)
325 "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)
326 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)
;
327
328 return NS_OK;
329}
330
331nsresult CacheFileContextEvictor::LoadEvictInfoFromDisk() {
332 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)
;
333
334 nsresult rv;
335
336 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 336); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 336; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
337
338 sDiskAlreadySearched = true;
339
340 nsCOMPtr<nsIDirectoryEnumerator> dirEnum;
341 rv = mCacheDirectory->GetDirectoryEntries(getter_AddRefs(dirEnum));
342 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 342)
) {
343 return rv;
344 }
345
346 while (true) {
347 nsCOMPtr<nsIFile> file;
348 rv = dirEnum->GetNextFile(getter_AddRefs(file));
Value stored to 'rv' is never read
349 if (!file) {
350 break;
351 }
352
353 bool isDir = false;
354 file->IsDirectory(&isDir);
355 if (isDir) {
356 continue;
357 }
358
359 nsAutoCString leaf;
360 rv = file->GetNativeLeafName(leaf);
361 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
362 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)
363 ("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)
364 "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)
;
365 continue;
366 }
367
368 if (leaf.Length() < kContextEvictionPrefixLength) {
369 continue;
370 }
371
372 if (!StringBeginsWith(leaf, nsLiteralCString(CONTEXT_EVICTION_PREFIX"ce_"))) {
373 continue;
374 }
375
376 nsAutoCString encoded;
377 encoded = Substring(leaf, kContextEvictionPrefixLength);
378 encoded.ReplaceChar('-', '/');
379
380 nsAutoCString decoded;
381 rv = Base64Decode(encoded, decoded);
382 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
383 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)
384 ("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)
385 "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)
386 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)
;
387 file->Remove(false);
388 continue;
389 }
390
391 bool pinned = decoded[0] == '\t';
392 if (pinned) {
393 decoded = Substring(decoded, 1);
394 }
395
396 // Let's see if we have an origin.
397 nsAutoCString origin;
398 if (decoded.Contains('\t')) {
399 auto split = decoded.Split('\t');
400 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", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 400); AnnotateMozCrashReason("MOZ_ASSERT" "(" "decoded.CountChar('\\t') == 1"
")"); do { *((volatile int*)__null) = 400; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
401
402 auto splitIt = split.begin();
403 origin = *splitIt;
404 ++splitIt;
405 decoded = *splitIt;
406 }
407
408 nsCOMPtr<nsILoadContextInfo> info;
409 if (!"*"_ns.Equals(decoded)) {
410 // "*" is indication of 'delete all', info left null will pass
411 // to CacheFileContextEvictor::AddContext and clear all the cache data.
412 info = CacheFileUtils::ParseKey(decoded);
413 if (!info) {
414 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)
415 ("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)
416 "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)
417 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)
;
418 file->Remove(false);
419 continue;
420 }
421 }
422
423 PRTime lastModifiedTime;
424 rv = file->GetLastModifiedTime(&lastModifiedTime);
425 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
426 continue;
427 }
428
429 CacheFileContextEvictorEntry* entry = new CacheFileContextEvictorEntry();
430 entry->mInfo = info;
431 entry->mPinned = pinned;
432 CopyUTF8toUTF16(origin, entry->mOrigin);
433 entry->mTimeStamp = lastModifiedTime;
434 mEntries.AppendElement(entry);
435 }
436
437 return NS_OK;
438}
439
440nsresult CacheFileContextEvictor::GetContextFile(
441 nsILoadContextInfo* aLoadContextInfo, bool aPinned,
442 const nsAString& aOrigin, nsIFile** _retval) {
443 nsresult rv;
444
445 nsAutoCString keyPrefix;
446 if (aPinned) {
447 // Mark pinned context files with a tab char at the start.
448 // Tab is chosen because it can never be used as a context key tag.
449 keyPrefix.Append('\t');
450 }
451 if (aLoadContextInfo) {
452 CacheFileUtils::AppendKeyPrefix(aLoadContextInfo, keyPrefix);
453 } else {
454 keyPrefix.Append('*');
455 }
456 if (!aOrigin.IsEmpty()) {
457 keyPrefix.Append('\t');
458 keyPrefix.Append(NS_ConvertUTF16toUTF8(aOrigin));
459 }
460
461 nsAutoCString leafName;
462 leafName.AssignLiteral(CONTEXT_EVICTION_PREFIX"ce_");
463
464 rv = Base64EncodeAppend(keyPrefix, leafName);
465 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 465)
) {
466 return rv;
467 }
468
469 // Replace '/' with '-' since '/' cannot be part of the filename.
470 leafName.ReplaceChar('/', '-');
471
472 nsCOMPtr<nsIFile> file;
473 rv = mCacheDirectory->Clone(getter_AddRefs(file));
474 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 474)
) {
475 return rv;
476 }
477
478 rv = file->AppendNative(leafName);
479 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 479)
) {
480 return rv;
481 }
482
483 file.swap(*_retval);
484 return NS_OK;
485}
486
487void CacheFileContextEvictor::CreateIterators() {
488 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)
;
489
490 CloseIterators();
491
492 nsresult rv;
493
494 for (uint32_t i = 0; i < mEntries.Length();) {
495 rv = CacheIndex::GetIterator(mEntries[i]->mInfo, false,
496 getter_AddRefs(mEntries[i]->mIterator));
497 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
498 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)
499 ("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)
500 ". [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)
501 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)
;
502 mEntries.RemoveElementAt(i);
503 continue;
504 }
505
506 ++i;
507 }
508}
509
510void CacheFileContextEvictor::CloseIterators() {
511 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)
;
512
513 for (uint32_t i = 0; i < mEntries.Length(); ++i) {
514 if (mEntries[i]->mIterator) {
515 mEntries[i]->mIterator->Close();
516 mEntries[i]->mIterator = nullptr;
517 }
518 }
519}
520
521void CacheFileContextEvictor::StartEvicting() {
522 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)
;
523
524 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 524); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 524; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
525
526 if (mEvicting) {
527 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)
;
528 return;
529 }
530
531 if (mEntries.Length() == 0) {
532 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)
;
533 return;
534 }
535
536 nsCOMPtr<nsIRunnable> ev =
537 NewRunnableMethod("net::CacheFileContextEvictor::EvictEntries", this,
538 &CacheFileContextEvictor::EvictEntries);
539
540 RefPtr<CacheIOThread> ioThread = CacheFileIOManager::IOThread();
541
542 nsresult rv = ioThread->Dispatch(ev, CacheIOThread::EVICT);
543 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
544 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)
545 ("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)
546 "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)
547 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)
;
548 }
549
550 mEvicting = true;
551}
552
553void CacheFileContextEvictor::EvictEntries() {
554 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)
;
555
556 nsresult rv;
557
558 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()", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 558); AnnotateMozCrashReason("MOZ_ASSERT" "(" "CacheFileIOManager::IsOnIOThread()"
")"); do { *((volatile int*)__null) = 558; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
559
560 mEvicting = false;
561
562 if (!mIndexIsUpToDate) {
563 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)
564 ("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)
565 "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)
;
566 return;
567 }
568
569 while (true) {
570 if (CacheObserver::ShuttingDown()) {
571 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)
572 ("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)
573 "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)
;
574 mEvicting =
575 true; // We don't want to start eviction again during shutdown
576 // process. Setting this flag to true ensures it.
577 return;
578 }
579
580 if (CacheIOThread::YieldAndRerun()) {
581 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)
582 ("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)
583 "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)
;
584 mEvicting = true;
585 return;
586 }
587
588 if (mEntries.Length() == 0) {
589 LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log
; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module
, mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print
(moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Stopping evicting, there "
"is no context to evict."); } } while (0)
590 ("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)
591 "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)
;
592
593 // Allow index to notify AsyncGetDiskConsumption callbacks. The size is
594 // actual again.
595 CacheIndex::OnAsyncEviction(false);
596 return;
597 }
598
599 SHA1Sum::Hash hash;
600 rv = mEntries[0]->mIterator->GetNextHash(&hash);
601 if (rv == NS_ERROR_NOT_AVAILABLE) {
602 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)
603 ("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)
604 "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)
605 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)
;
606 RemoveEvictInfoFromDisk(mEntries[0]->mInfo, mEntries[0]->mPinned,
607 mEntries[0]->mOrigin);
608 mEntries.RemoveElementAt(0);
609 continue;
610 }
611 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
612 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)
613 ("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)
614 "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)
615 " [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)
616 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)
;
617 mEntries.RemoveElementAt(0);
618 continue;
619 }
620
621 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)
622 ("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)
623 "[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)
624 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)
625 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)
;
626
627 RefPtr<CacheFileHandle> handle;
628 CacheFileIOManager::gInstance->mHandles.GetHandle(&hash,
629 getter_AddRefs(handle));
630 if (handle) {
631 // We doom any active handle in CacheFileIOManager::EvictByContext(), so
632 // this must be a new one. Skip it.
633 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]", handle.get()); } } while
(0)
634 ("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]", handle.get()); } } while
(0)
635 "found an active handle. [handle=%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() - Skipping entry since we "
"found an active handle. [handle=%p]", handle.get()); } } while
(0)
636 handle.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]", handle.get()); } } while
(0)
;
637 continue;
638 }
639
640 CacheIndex::EntryStatus status;
641 bool pinned = false;
642 auto callback = [&pinned](const CacheIndexEntry* aEntry) {
643 pinned = aEntry->IsPinned();
644 };
645 rv = CacheIndex::HasEntry(hash, &status, callback);
646 // This must never fail, since eviction (this code) happens only when the
647 // index is up-to-date and thus the informatin is known.
648 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)))", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 648); AnnotateMozCrashReason("MOZ_ASSERT" "(" "((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1)))"
")"); do { *((volatile int*)__null) = 648; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
649
650 if (pinned != mEntries[0]->mPinned) {
651 LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log
; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module
, mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print
(moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping entry since "
"pinning " "doesn't match [evicting pinned=%d, entry pinned=%d]"
, mEntries[0]->mPinned, pinned); } } while (0)
652 ("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)
653 "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)
654 "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)
655 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)
;
656 continue;
657 }
658
659 if (!mEntries[0]->mOrigin.IsEmpty()) {
660 nsCOMPtr<nsIFile> file;
661 CacheFileIOManager::gInstance->GetFile(&hash, getter_AddRefs(file));
662
663 // Read metadata from the file synchronously
664 RefPtr<CacheFileMetadata> metadata = new CacheFileMetadata();
665 rv = metadata->SyncReadMetadata(file);
666 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 666)
) {
667 continue;
668 }
669
670 // Now get the context + enhance id + URL from the key.
671 nsAutoCString uriSpec;
672 RefPtr<nsILoadContextInfo> info =
673 CacheFileUtils::ParseKey(metadata->GetKey(), nullptr, &uriSpec);
674 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", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 674); AnnotateMozCrashReason("MOZ_ASSERT" "(" "info" ")"); do
{ *((volatile int*)__null) = 674; __attribute__((nomerge)) ::
abort(); } while (false); } } while (false)
;
675 if (!info) {
676 continue;
677 }
678
679 nsCOMPtr<nsIURI> uri;
680 rv = NS_NewURI(getter_AddRefs(uri), uriSpec);
681 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
682 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 to parse the uriSpec"); } } while (0)
683 ("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 to parse the uriSpec"); } } while (0)
684 "NS_NewURI failed to parse the uriSpec"))do { const ::mozilla::LogModule* moz_real_module = gCache2Log
; if ((__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 to parse the uriSpec"); } } while (0)
;
685 continue;
686 }
687
688 nsAutoString urlOrigin;
689 rv = nsContentUtils::GetWebExposedOriginSerialization(uri, urlOrigin);
690 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
691 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)
692 ("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)
693 "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)
;
694 continue;
695 }
696
697 if (!urlOrigin.Equals(mEntries[0]->mOrigin)) {
698 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)
699 ("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)
700 "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)
701 "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)
;
702 continue;
703 }
704 }
705
706 nsAutoCString leafName;
707 CacheFileIOManager::HashToStr(&hash, leafName);
708
709 PRTime lastModifiedTime;
710 nsCOMPtr<nsIFile> file;
711 rv = mEntriesDir->Clone(getter_AddRefs(file));
712 if (NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1)))) {
713 rv = file->AppendNative(leafName);
714 }
715 if (NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1)))) {
716 rv = file->GetLastModifiedTime(&lastModifiedTime);
717 }
718 if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) {
719 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)
720 ("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)
721 "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)
;
722 continue;
723 }
724
725 if (lastModifiedTime > mEntries[0]->mTimeStamp) {
726 LOG(do { const ::mozilla::LogModule* moz_real_module = gCache2Log
; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module
, mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print
(moz_real_module, mozilla::LogLevel::Debug, "CacheFileContextEvictor::EvictEntries() - Skipping newer entry. "
"[mTimeStamp=%" "l" "d" ", lastModifiedTime=%" "l" "d" "]", mEntries
[0]->mTimeStamp, lastModifiedTime); } } while (0)
727 ("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)
728 "[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)
729 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)
;
730 continue;
731 }
732
733 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)
;
734 file->Remove(false);
735 CacheIndex::RemoveEntry(&hash);
736 }
737
738 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" ")", "/var/lib/jenkins/workspace/firefox-scan-build/netwerk/cache2/CacheFileContextEvictor.cpp"
, 738); AnnotateMozCrashReason("MOZ_ASSERT" "(" "false" ") ("
"MOZ_ASSERT_UNREACHABLE: " "We should never get here" ")"); do
{ *((volatile int*)__null) = 738; __attribute__((nomerge)) ::
abort(); } while (false); } } while (false)
;
739}
740
741} // namespace mozilla::net