mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1187134 (part 4) - Replace nsBaseHashtable::Enumerate() calls in netwerk/cache{,2}/ with iterators. r=valentin.
This commit is contained in:
parent
ebabc765c0
commit
c6eb443078
@ -882,7 +882,7 @@ CacheFile::ThrowMemoryCachedData()
|
|||||||
|
|
||||||
// We cannot release all cached chunks since we need to keep preloaded chunks
|
// We cannot release all cached chunks since we need to keep preloaded chunks
|
||||||
// in memory. See initialization of mPreloadChunkCount for explanation.
|
// in memory. See initialization of mPreloadChunkCount for explanation.
|
||||||
mCachedChunks.Enumerate(&CacheFile::CleanUpCachedChunks, this);
|
CleanUpCachedChunks();
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -1587,7 +1587,7 @@ CacheFile::RemoveInput(CacheFileInputStream *aInput, nsresult aStatus)
|
|||||||
|
|
||||||
// If the input didn't read all data, there might be left some preloaded
|
// If the input didn't read all data, there might be left some preloaded
|
||||||
// chunks that won't be used anymore.
|
// chunks that won't be used anymore.
|
||||||
mCachedChunks.Enumerate(&CacheFile::CleanUpCachedChunks, this);
|
CleanUpCachedChunks();
|
||||||
|
|
||||||
Telemetry::Accumulate(Telemetry::NETWORK_CACHE_V2_INPUT_STREAM_STATUS,
|
Telemetry::Accumulate(Telemetry::NETWORK_CACHE_V2_INPUT_STREAM_STATUS,
|
||||||
StatusToTelemetryEnum(aStatus));
|
StatusToTelemetryEnum(aStatus));
|
||||||
@ -1895,23 +1895,24 @@ CacheFile::FailUpdateListeners(
|
|||||||
return PL_DHASH_NEXT;
|
return PL_DHASH_NEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLDHashOperator
|
void
|
||||||
CacheFile::CleanUpCachedChunks(const uint32_t& aIdx,
|
CacheFile::CleanUpCachedChunks()
|
||||||
RefPtr<CacheFileChunk>& aChunk,
|
|
||||||
void* aClosure)
|
|
||||||
{
|
{
|
||||||
CacheFile *file = static_cast<CacheFile*>(aClosure);
|
for (auto iter = mCachedChunks.Iter(); !iter.Done(); iter.Next()) {
|
||||||
|
uint32_t idx = iter.Key();
|
||||||
|
const RefPtr<CacheFileChunk>& chunk = iter.Data();
|
||||||
|
|
||||||
LOG(("CacheFile::CleanUpCachedChunks() [this=%p, idx=%u, chunk=%p]", file,
|
LOG(("CacheFile::CleanUpCachedChunks() [this=%p, idx=%u, chunk=%p]", this,
|
||||||
aIdx, aChunk.get()));
|
idx, chunk.get()));
|
||||||
|
|
||||||
if (file->MustKeepCachedChunk(aIdx)) {
|
if (MustKeepCachedChunk(idx)) {
|
||||||
LOG(("CacheFile::CleanUpCachedChunks() - Keeping chunk"));
|
LOG(("CacheFile::CleanUpCachedChunks() - Keeping chunk"));
|
||||||
return PL_DHASH_NEXT;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(("CacheFile::CleanUpCachedChunks() - Removing chunk"));
|
LOG(("CacheFile::CleanUpCachedChunks() - Removing chunk"));
|
||||||
return PL_DHASH_REMOVE;
|
iter.Remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -173,9 +173,7 @@ private:
|
|||||||
RefPtr<CacheFileChunk>& aChunk,
|
RefPtr<CacheFileChunk>& aChunk,
|
||||||
void* aClosure);
|
void* aClosure);
|
||||||
|
|
||||||
static PLDHashOperator CleanUpCachedChunks(const uint32_t& aIdx,
|
void CleanUpCachedChunks();
|
||||||
RefPtr<CacheFileChunk>& aChunk,
|
|
||||||
void* aClosure);
|
|
||||||
|
|
||||||
nsresult PadChunkWithZeroes(uint32_t aChunkIdx);
|
nsresult PadChunkWithZeroes(uint32_t aChunkIdx);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user