/src/mozilla-central/netwerk/cache2/CacheIndexContextIterator.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | |
11 | | namespace mozilla { |
12 | | namespace net { |
13 | | |
14 | | CacheIndexContextIterator::CacheIndexContextIterator(CacheIndex *aIndex, |
15 | | bool aAddNew, |
16 | | nsILoadContextInfo *aInfo) |
17 | | : CacheIndexIterator(aIndex, aAddNew) |
18 | | , mInfo(aInfo) |
19 | 0 | { |
20 | 0 | } |
21 | | |
22 | | void |
23 | | CacheIndexContextIterator::AddRecord(CacheIndexRecord *aRecord) |
24 | 0 | { |
25 | 0 | if (CacheIndexEntry::RecordMatchesLoadContextInfo(aRecord, mInfo)) { |
26 | 0 | CacheIndexIterator::AddRecord(aRecord); |
27 | 0 | } |
28 | 0 | } |
29 | | |
30 | | void |
31 | | CacheIndexContextIterator::AddRecords( |
32 | | const nsTArray<CacheIndexRecord *> &aRecords) |
33 | 0 | { |
34 | 0 | // We need to add one by one so that those with wrong context are ignored. |
35 | 0 | for (uint32_t i = 0; i < aRecords.Length(); ++i) { |
36 | 0 | AddRecord(aRecords[i]); |
37 | 0 | } |
38 | 0 | } |
39 | | |
40 | | } // namespace net |
41 | | } // namespace mozilla |