mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 23:06:52 +00:00
18ad48cb0e
- Bug 1217835 - Rewrite some code in CanvasRenderingContext2D::GetImageDataArray to avoid build warnings; r=gw280 (cedba0b14a) - Bug 1232864 - Cauterize and release WebGL 2 to Nightly. - r=jrmuizel (5a16387f1d) - Bug 1229585 - Add helpful error text for fb incompleteness. - r=kamidphish (1a3d7505e2) - Bug 1231303 - Moz2Dify nsFilterInstance. r=roc. (44ec4c5df6) - Bug 1229235 - Make RedirectChannelRegistrar thread-safe. r=jduell (5acca6a770) - Bug 1211090 - Use Buffered IO for PrefixSet load/store. r=froydnj (00720fe291) - Bug 1211090 - Add fallocate support to nsIOutputFileStream and use it. r=froydnj (6a49aa4a5f) - Bug 1211090 - Don't fail to open databases if we can't do buffered IO. r=froydnj (70ab38e03b) - Bug 1223808 - part 3 - replace nsAutoArrayPtr<T> with UniquePtr<T[]> in netwerk/; r=mcmanus (4a1d880135) - Bug 1223808 - part 1 - optimize creating a WebSocketFrame with a payload; r=mcmanus (9a046a6f0a) - Bug 1223808 - part 2 - use UniquePtr<uint8_t[]> instead of nsAutoArrayPtr<SHA1Sum::Hash> in HandleHashKey; r=michal (c6a0f6d5d3) - Bug 1167053 - Convert NetUtil.newChannel2 callsites to use new API - remove newChannel2,asyncFetch2 (r=sicking,paolo) (875b9c78f0) - Bug 1185982 - Remove the unused NotifyNetworkActivity::mObs member; r=bagder (f09d2676f7) - bits of Bug 1152597 - Icons are shown for some apps. (9a289ab9ec) - Bug 1223231 - Use channel.asyncOpen2 in devtools/client/shared/AppCacheUtils.jsm (r=sicking) (5c635d797c) - Bug 1208905 - Fix a condition in PresentationResponderLoadingCallback::Init; r=baku (ff84b8a595) - Bug 1231677 - verify the return of mDiscoveryTimer->Init, if it faild exit function with error code. r=jst (04b8be172c) - Bug 1199564 - start/stop mDNS on demand - v3. r=mcmanus (66d7ef06e6) - Bug 1225726 - enable nsDNSServiceDiscovery on OS X. r=mcmanus. (01ea13e4a6) - Bug 1172383 - Stop mDNS properly during destruction. r=mcmanus (c041817b7e) - Bug 1198058 - Fix crashes inspecting loadGroups in browser toolbox. r=mcmanus (462b5aa8bd) - Bug 1220607 - Expand on the nsILoadGroup interface's comment to indicate how it is used. r=bz IGNORE IDL (49a95cc217) - use response for response (348055fc69) - Remove some old clobber-workarounds. No bug. (db7e7c4773) - Bug 280280 - Make "no proxy for" do domain comparison. r=bagder (4804e39fd6) - backout f600f0cd7bb3 (Bug 1170646) because of Thunderbird regressions with OSX, r=michal (d43ba00896) - Bug 1220215 - Add '#' between client id and suffix in appcache groud id, r=jduell (240fcec72a) - Bug 1198792 - Clear Application Cache internal hashtables on Clear Recent History, r=jduell (1313393dc5) - Bug 1222782 - TSan: data race netwerk/cache2/CacheIOThread.cpp:148 Target (race on mXPCOMThread), r=jseward (d56470a300) - Bug 1190951 - TSan: data race netwerk/cache2/CacheIndex.cpp:1397 CacheIndex::IsUpToDate, r=valentin.gosu (24934e1885)
127 lines
2.8 KiB
C++
127 lines
2.8 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "CacheLog.h"
|
|
#include "CacheIndexIterator.h"
|
|
#include "CacheIndex.h"
|
|
#include "nsString.h"
|
|
#include "mozilla/DebugOnly.h"
|
|
|
|
|
|
namespace mozilla {
|
|
namespace net {
|
|
|
|
CacheIndexIterator::CacheIndexIterator(CacheIndex *aIndex, bool aAddNew)
|
|
: mStatus(NS_OK)
|
|
, mIndex(aIndex)
|
|
, mAddNew(aAddNew)
|
|
{
|
|
LOG(("CacheIndexIterator::CacheIndexIterator() [this=%p]", this));
|
|
}
|
|
|
|
CacheIndexIterator::~CacheIndexIterator()
|
|
{
|
|
LOG(("CacheIndexIterator::~CacheIndexIterator() [this=%p]", this));
|
|
|
|
Close();
|
|
}
|
|
|
|
nsresult
|
|
CacheIndexIterator::GetNextHash(SHA1Sum::Hash *aHash)
|
|
{
|
|
LOG(("CacheIndexIterator::GetNextHash() [this=%p]", this));
|
|
|
|
StaticMutexAutoLock lock(CacheIndex::sLock);
|
|
|
|
if (NS_FAILED(mStatus)) {
|
|
return mStatus;
|
|
}
|
|
|
|
if (!mRecords.Length()) {
|
|
CloseInternal(NS_ERROR_NOT_AVAILABLE);
|
|
return mStatus;
|
|
}
|
|
|
|
memcpy(aHash, mRecords[mRecords.Length() - 1]->mHash, sizeof(SHA1Sum::Hash));
|
|
mRecords.RemoveElementAt(mRecords.Length() - 1);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
CacheIndexIterator::Close()
|
|
{
|
|
LOG(("CacheIndexIterator::Close() [this=%p]", this));
|
|
|
|
StaticMutexAutoLock lock(CacheIndex::sLock);
|
|
|
|
return CloseInternal(NS_ERROR_NOT_AVAILABLE);
|
|
}
|
|
|
|
nsresult
|
|
CacheIndexIterator::CloseInternal(nsresult aStatus)
|
|
{
|
|
LOG(("CacheIndexIterator::CloseInternal() [this=%p, status=0x%08x]", this,
|
|
aStatus));
|
|
|
|
// Make sure status will be a failure
|
|
MOZ_ASSERT(NS_FAILED(aStatus));
|
|
if (NS_SUCCEEDED(aStatus)) {
|
|
aStatus = NS_ERROR_UNEXPECTED;
|
|
}
|
|
|
|
if (NS_FAILED(mStatus)) {
|
|
return NS_ERROR_NOT_AVAILABLE;
|
|
}
|
|
|
|
DebugOnly<bool> removed = mIndex->mIterators.RemoveElement(this);
|
|
MOZ_ASSERT(removed);
|
|
mStatus = aStatus;
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
CacheIndexIterator::AddRecord(CacheIndexRecord *aRecord)
|
|
{
|
|
LOG(("CacheIndexIterator::AddRecord() [this=%p, record=%p]", this, aRecord));
|
|
|
|
mRecords.AppendElement(aRecord);
|
|
}
|
|
|
|
void
|
|
CacheIndexIterator::AddRecords(const nsTArray<CacheIndexRecord *> &aRecords)
|
|
{
|
|
LOG(("CacheIndexIterator::AddRecords() [this=%p]", this));
|
|
|
|
mRecords.AppendElements(aRecords);
|
|
}
|
|
|
|
bool
|
|
CacheIndexIterator::RemoveRecord(CacheIndexRecord *aRecord)
|
|
{
|
|
LOG(("CacheIndexIterator::RemoveRecord() [this=%p, record=%p]", this,
|
|
aRecord));
|
|
|
|
return mRecords.RemoveElement(aRecord);
|
|
}
|
|
|
|
bool
|
|
CacheIndexIterator::ReplaceRecord(CacheIndexRecord *aOldRecord,
|
|
CacheIndexRecord *aNewRecord)
|
|
{
|
|
LOG(("CacheIndexIterator::ReplaceRecord() [this=%p, oldRecord=%p, "
|
|
"newRecord=%p]", this, aOldRecord, aNewRecord));
|
|
|
|
if (RemoveRecord(aOldRecord)) {
|
|
AddRecord(aNewRecord);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
} // namespace net
|
|
} // namespace mozilla
|