1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/cache2/CacheIndexContextIterator.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,45 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "CacheLog.h" 1.9 +#include "CacheIndexContextIterator.h" 1.10 +#include "CacheIndex.h" 1.11 +#include "nsString.h" 1.12 + 1.13 + 1.14 +namespace mozilla { 1.15 +namespace net { 1.16 + 1.17 +CacheIndexContextIterator::CacheIndexContextIterator(CacheIndex *aIndex, 1.18 + bool aAddNew, 1.19 + nsILoadContextInfo *aInfo) 1.20 + : CacheIndexIterator(aIndex, aAddNew) 1.21 + , mInfo(aInfo) 1.22 +{ 1.23 +} 1.24 + 1.25 +CacheIndexContextIterator::~CacheIndexContextIterator() 1.26 +{ 1.27 +} 1.28 + 1.29 +void 1.30 +CacheIndexContextIterator::AddRecord(CacheIndexRecord *aRecord) 1.31 +{ 1.32 + if (CacheIndexEntry::RecordMatchesLoadContextInfo(aRecord, mInfo)) { 1.33 + CacheIndexIterator::AddRecord(aRecord); 1.34 + } 1.35 +} 1.36 + 1.37 +void 1.38 +CacheIndexContextIterator::AddRecords( 1.39 + const nsTArray<CacheIndexRecord *> &aRecords) 1.40 +{ 1.41 + // We need to add one by one so that those with wrong context are ignored. 1.42 + for (uint32_t i = 0; i < aRecords.Length(); ++i) { 1.43 + AddRecord(aRecords[i]); 1.44 + } 1.45 +} 1.46 + 1.47 +} // net 1.48 +} // mozilla