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