Source code

Revision control

Other Tools

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 "CacheIndexContextIterator.h"
7
#include "CacheIndex.h"
8
#include "nsString.h"
9
10
namespace mozilla {
11
namespace net {
12
13
CacheIndexContextIterator::CacheIndexContextIterator(CacheIndex* aIndex,
14
bool aAddNew,
15
nsILoadContextInfo* aInfo)
16
: CacheIndexIterator(aIndex, aAddNew), mInfo(aInfo) {}
17
18
void CacheIndexContextIterator::AddRecord(CacheIndexRecord* aRecord) {
19
if (CacheIndexEntry::RecordMatchesLoadContextInfo(aRecord, mInfo)) {
20
CacheIndexIterator::AddRecord(aRecord);
21
}
22
}
23
24
void CacheIndexContextIterator::AddRecords(
25
const nsTArray<CacheIndexRecord*>& aRecords) {
26
// We need to add one by one so that those with wrong context are ignored.
27
for (uint32_t i = 0; i < aRecords.Length(); ++i) {
28
AddRecord(aRecords[i]);
29
}
30
}
31
32
} // namespace net
33
} // namespace mozilla