michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "CacheLog.h" michael@0: #include "CacheIndexContextIterator.h" michael@0: #include "CacheIndex.h" michael@0: #include "nsString.h" michael@0: michael@0: michael@0: namespace mozilla { michael@0: namespace net { michael@0: michael@0: CacheIndexContextIterator::CacheIndexContextIterator(CacheIndex *aIndex, michael@0: bool aAddNew, michael@0: nsILoadContextInfo *aInfo) michael@0: : CacheIndexIterator(aIndex, aAddNew) michael@0: , mInfo(aInfo) michael@0: { michael@0: } michael@0: michael@0: CacheIndexContextIterator::~CacheIndexContextIterator() michael@0: { michael@0: } michael@0: michael@0: void michael@0: CacheIndexContextIterator::AddRecord(CacheIndexRecord *aRecord) michael@0: { michael@0: if (CacheIndexEntry::RecordMatchesLoadContextInfo(aRecord, mInfo)) { michael@0: CacheIndexIterator::AddRecord(aRecord); michael@0: } michael@0: } michael@0: michael@0: void michael@0: CacheIndexContextIterator::AddRecords( michael@0: const nsTArray &aRecords) michael@0: { michael@0: // We need to add one by one so that those with wrong context are ignored. michael@0: for (uint32_t i = 0; i < aRecords.Length(); ++i) { michael@0: AddRecord(aRecords[i]); michael@0: } michael@0: } michael@0: michael@0: } // net michael@0: } // mozilla