summaryrefslogtreecommitdiffstats
path: root/netwerk
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-11-03 09:06:25 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-11-03 09:06:25 +0100
commit1626b5d7041ea9c3db92200f91542da46e49dde6 (patch)
treee99c393052ef818645027da57774672990e29514 /netwerk
parent314fb761d144b160d3aeb72840c89e31c4f21a4a (diff)
parent1d55939c7ca0e80555a24b240ff68d5bdbb48b4a (diff)
downloadUXP-1626b5d7041ea9c3db92200f91542da46e49dde6.tar
UXP-1626b5d7041ea9c3db92200f91542da46e49dde6.tar.gz
UXP-1626b5d7041ea9c3db92200f91542da46e49dde6.tar.lz
UXP-1626b5d7041ea9c3db92200f91542da46e49dde6.tar.xz
UXP-1626b5d7041ea9c3db92200f91542da46e49dde6.zip
Merge branch 'master' into Basilisk-releasev2018.11.04
Diffstat (limited to 'netwerk')
-rw-r--r--netwerk/base/nsIOService.cpp4
-rw-r--r--netwerk/base/nsNetUtilInlines.h4
-rw-r--r--netwerk/base/nsSocketTransportService2.cpp36
-rw-r--r--netwerk/base/nsUDPSocket.cpp6
-rw-r--r--netwerk/cache/nsCacheEntryDescriptor.cpp83
-rw-r--r--netwerk/cache/nsCacheService.cpp66
-rw-r--r--netwerk/cache/nsCacheService.h6
-rw-r--r--netwerk/cache2/CacheEntry.cpp15
-rw-r--r--netwerk/cache2/CacheFile.cpp27
-rw-r--r--netwerk/cache2/CacheFileIOManager.cpp48
-rw-r--r--netwerk/cache2/CacheFileUtils.cpp95
-rw-r--r--netwerk/cache2/CacheFileUtils.h59
-rw-r--r--netwerk/cache2/CacheIOThread.cpp54
-rw-r--r--netwerk/cache2/CacheIndex.cpp98
-rw-r--r--netwerk/cache2/CacheIndex.h5
-rw-r--r--netwerk/cache2/CacheObserver.cpp58
-rw-r--r--netwerk/cache2/CacheObserver.h10
-rw-r--r--netwerk/cookie/nsCookieService.cpp7
-rw-r--r--netwerk/protocol/http/Http2Compression.cpp26
-rw-r--r--netwerk/sctp/datachannel/DataChannel.cpp1
-rw-r--r--netwerk/streamconv/converters/nsIndexedToHTML.cpp20
21 files changed, 110 insertions, 618 deletions
diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp
index e13541acf..435294315 100644
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -789,7 +789,9 @@ nsIOService::NewChannelFromURIWithProxyFlagsInternal(nsIURI* aURI,
// creating a new channel by calling NewChannel().
if (NS_FAILED(rv)) {
rv = handler->NewChannel(aURI, getter_AddRefs(channel));
- NS_ENSURE_SUCCESS(rv, rv);
+ if (NS_FAILED(rv)) {
+ return rv;
+ }
// The protocol handler does not implement NewChannel2, so
// maybe we need to wrap the channel (see comment in MaybeWrap
// function).
diff --git a/netwerk/base/nsNetUtilInlines.h b/netwerk/base/nsNetUtilInlines.h
index 7003814d5..b831ec2e7 100644
--- a/netwerk/base/nsNetUtilInlines.h
+++ b/netwerk/base/nsNetUtilInlines.h
@@ -224,7 +224,9 @@ NS_NewChannelInternal(nsIChannel **outChannel,
aUri,
aLoadInfo,
getter_AddRefs(channel));
- NS_ENSURE_SUCCESS(rv, rv);
+ if (NS_FAILED(rv)) {
+ return rv;
+ }
if (aLoadGroup) {
rv = channel->SetLoadGroup(aLoadGroup);
diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp
index 72afdc9e1..739388b0f 100644
--- a/netwerk/base/nsSocketTransportService2.cpp
+++ b/netwerk/base/nsSocketTransportService2.cpp
@@ -471,9 +471,6 @@ nsSocketTransportService::Poll(uint32_t *interval,
PRIntervalTime ts = PR_IntervalNow();
TimeStamp pollStart;
- if (mTelemetryEnabledPref) {
- pollStart = TimeStamp::NowLoRes();
- }
SOCKET_LOG((" timeout = %i milliseconds\n",
PR_IntervalToMilliseconds(pollTimeout)));
@@ -481,10 +478,6 @@ nsSocketTransportService::Poll(uint32_t *interval,
PRIntervalTime passedInterval = PR_IntervalNow() - ts;
- if (mTelemetryEnabledPref && !pollStart.IsNull()) {
- *pollDuration = TimeStamp::NowLoRes() - pollStart;
- }
-
SOCKET_LOG((" ...returned after %i milliseconds\n",
PR_IntervalToMilliseconds(passedInterval)));
@@ -858,20 +851,9 @@ nsSocketTransportService::Run()
// make sure the pseudo random number generator is seeded on this thread
srand(static_cast<unsigned>(PR_Now()));
- // For the calculation of the duration of the last cycle (i.e. the last for-loop
- // iteration before shutdown).
- TimeStamp startOfCycleForLastCycleCalc;
- int numberOfPendingEventsLastCycle;
-
- // For measuring of the poll iteration duration without time spent blocked
- // in poll().
- TimeStamp pollCycleStart;
// Time blocked in poll().
TimeDuration singlePollDuration;
- // For calculating the time needed for a new element to run.
- TimeStamp startOfIteration;
- TimeStamp startOfNextIteration;
int numberOfPendingEvents;
// If there is too many pending events queued, we will run some poll()
@@ -883,18 +865,9 @@ nsSocketTransportService::Run()
bool pendingEvents = false;
numberOfPendingEvents = 0;
- numberOfPendingEventsLastCycle = 0;
- if (mTelemetryEnabledPref) {
- startOfCycleForLastCycleCalc = TimeStamp::NowLoRes();
- startOfNextIteration = TimeStamp::NowLoRes();
- }
pollDuration = 0;
do {
- if (mTelemetryEnabledPref) {
- pollCycleStart = TimeStamp::NowLoRes();
- }
-
DoPollIteration(&singlePollDuration);
mRawThread->HasPendingEvents(&pendingEvents);
@@ -909,15 +882,6 @@ nsSocketTransportService::Run()
} else {
mServingPendingQueue = true;
}
-
- if (mTelemetryEnabledPref) {
- startOfIteration = startOfNextIteration;
- // Everything that comes after this point will
- // be served in the next iteration. If no even
- // arrives, startOfNextIteration will be reset at the
- // beginning of each for-loop.
- startOfNextIteration = TimeStamp::NowLoRes();
- }
}
TimeStamp eventQueueStart = TimeStamp::NowLoRes();
do {
diff --git a/netwerk/base/nsUDPSocket.cpp b/netwerk/base/nsUDPSocket.cpp
index 24f3954cb..445b62d9c 100644
--- a/netwerk/base/nsUDPSocket.cpp
+++ b/netwerk/base/nsUDPSocket.cpp
@@ -770,12 +770,6 @@ nsUDPSocket::CloseSocket()
// If shutdown last to long, let the socket leak and do not close it.
UDPSOCKET_LOG(("Intentional leak"));
} else {
-
- PRIntervalTime closeStarted = 0;
- if (gSocketTransportService->IsTelemetryEnabledAndNotSleepPhase()) {
- closeStarted = PR_IntervalNow();
- }
-
PR_Close(mFD);
}
mFD = nullptr;
diff --git a/netwerk/cache/nsCacheEntryDescriptor.cpp b/netwerk/cache/nsCacheEntryDescriptor.cpp
index 64765f8aa..35ea22d55 100644
--- a/netwerk/cache/nsCacheEntryDescriptor.cpp
+++ b/netwerk/cache/nsCacheEntryDescriptor.cpp
@@ -43,7 +43,7 @@ public:
nsresult status = NS_OK;
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSASYNCDOOMEVENT_RUN));
+ nsCacheServiceAutoLock lock;
if (mDescriptor->mCacheEntry) {
status = nsCacheService::gService->DoomEntry_Internal(
@@ -113,7 +113,7 @@ nsCacheEntryDescriptor::GetClientID(char ** result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETCLIENTID));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
return ClientIDFromCacheKey(*(mCacheEntry->Key()), result);
@@ -124,7 +124,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetDeviceID(char ** aDeviceID)
{
NS_ENSURE_ARG_POINTER(aDeviceID);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETDEVICEID));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
const char* deviceID = mCacheEntry->GetDeviceID();
@@ -141,7 +141,7 @@ nsCacheEntryDescriptor::GetDeviceID(char ** aDeviceID)
NS_IMETHODIMP
nsCacheEntryDescriptor::GetKey(nsACString &result)
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETKEY));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
return ClientKeyFromCacheKey(*(mCacheEntry->Key()), result);
@@ -152,7 +152,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetFetchCount(int32_t *result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETFETCHCOUNT));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->FetchCount();
@@ -164,7 +164,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetLastFetched(uint32_t *result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETLASTFETCHED));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->LastFetched();
@@ -176,7 +176,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetLastModified(uint32_t *result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETLASTMODIFIED));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->LastModified();
@@ -188,7 +188,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetExpirationTime(uint32_t *result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETEXPIRATIONTIME));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->ExpirationTime();
@@ -199,7 +199,7 @@ nsCacheEntryDescriptor::GetExpirationTime(uint32_t *result)
NS_IMETHODIMP
nsCacheEntryDescriptor::SetExpirationTime(uint32_t expirationTime)
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETEXPIRATIONTIME));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
mCacheEntry->SetExpirationTime(expirationTime);
@@ -211,7 +211,7 @@ nsCacheEntryDescriptor::SetExpirationTime(uint32_t expirationTime)
NS_IMETHODIMP nsCacheEntryDescriptor::IsStreamBased(bool *result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_ISSTREAMBASED));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->IsStreamData();
@@ -221,7 +221,7 @@ NS_IMETHODIMP nsCacheEntryDescriptor::IsStreamBased(bool *result)
NS_IMETHODIMP nsCacheEntryDescriptor::GetPredictedDataSize(int64_t *result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETPREDICTEDDATASIZE));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->PredictedDataSize();
@@ -231,7 +231,7 @@ NS_IMETHODIMP nsCacheEntryDescriptor::GetPredictedDataSize(int64_t *result)
NS_IMETHODIMP nsCacheEntryDescriptor::SetPredictedDataSize(int64_t
predictedSize)
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETPREDICTEDDATASIZE));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
mCacheEntry->SetPredictedDataSize(predictedSize);
@@ -241,7 +241,7 @@ NS_IMETHODIMP nsCacheEntryDescriptor::SetPredictedDataSize(int64_t
NS_IMETHODIMP nsCacheEntryDescriptor::GetDataSize(uint32_t *result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETDATASIZE));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
const char* val = mCacheEntry->GetMetaDataElement("uncompressed-len");
@@ -258,7 +258,7 @@ NS_IMETHODIMP nsCacheEntryDescriptor::GetDataSize(uint32_t *result)
NS_IMETHODIMP nsCacheEntryDescriptor::GetStorageDataSize(uint32_t *result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETSTORAGEDATASIZE));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->DataSize();
@@ -270,7 +270,7 @@ NS_IMETHODIMP nsCacheEntryDescriptor::GetStorageDataSize(uint32_t *result)
nsresult
nsCacheEntryDescriptor::RequestDataSizeChange(int32_t deltaSize)
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_REQUESTDATASIZECHANGE));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
nsresult rv;
@@ -288,7 +288,7 @@ nsCacheEntryDescriptor::RequestDataSizeChange(int32_t deltaSize)
NS_IMETHODIMP
nsCacheEntryDescriptor::SetDataSize(uint32_t dataSize)
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETDATASIZE));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
// XXX review for signed/unsigned math errors
@@ -317,7 +317,7 @@ nsCacheEntryDescriptor::OpenInputStream(uint32_t offset, nsIInputStream ** resul
nsInputStreamWrapper* cacheInput = nullptr;
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_OPENINPUTSTREAM));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
if (!mCacheEntry->IsStreamData()) return NS_ERROR_CACHE_DATA_IS_NOT_STREAM;
@@ -352,7 +352,7 @@ nsCacheEntryDescriptor::OpenOutputStream(uint32_t offset, nsIOutputStream ** res
nsOutputStreamWrapper* cacheOutput = nullptr;
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_OPENOUTPUTSTREAM));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
if (!mCacheEntry->IsStreamData()) return NS_ERROR_CACHE_DATA_IS_NOT_STREAM;
@@ -390,7 +390,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetCacheElement(nsISupports ** result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETCACHEELEMENT));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
if (mCacheEntry->IsStreamData()) return NS_ERROR_CACHE_DATA_IS_STREAM;
@@ -402,7 +402,7 @@ nsCacheEntryDescriptor::GetCacheElement(nsISupports ** result)
NS_IMETHODIMP
nsCacheEntryDescriptor::SetCacheElement(nsISupports * cacheElement)
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETCACHEELEMENT));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
if (mCacheEntry->IsStreamData()) return NS_ERROR_CACHE_DATA_IS_STREAM;
@@ -423,7 +423,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetStoragePolicy(nsCacheStoragePolicy *result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETSTORAGEPOLICY));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->StoragePolicy();
@@ -434,7 +434,7 @@ nsCacheEntryDescriptor::GetStoragePolicy(nsCacheStoragePolicy *result)
NS_IMETHODIMP
nsCacheEntryDescriptor::SetStoragePolicy(nsCacheStoragePolicy policy)
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETSTORAGEPOLICY));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
// XXX validate policy against session?
@@ -461,7 +461,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetFile(nsIFile ** result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETFILE));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
return nsCacheService::GetFileForEntry(mCacheEntry, result);
@@ -472,7 +472,7 @@ NS_IMETHODIMP
nsCacheEntryDescriptor::GetSecurityInfo(nsISupports ** result)
{
NS_ENSURE_ARG_POINTER(result);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETSECURITYINFO));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
*result = mCacheEntry->SecurityInfo();
@@ -484,7 +484,7 @@ nsCacheEntryDescriptor::GetSecurityInfo(nsISupports ** result)
NS_IMETHODIMP
nsCacheEntryDescriptor::SetSecurityInfo(nsISupports * securityInfo)
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETSECURITYINFO));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
mCacheEntry->SetSecurityInfo(securityInfo);
@@ -496,7 +496,7 @@ nsCacheEntryDescriptor::SetSecurityInfo(nsISupports * securityInfo)
NS_IMETHODIMP
nsCacheEntryDescriptor::Doom()
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_DOOM));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
return nsCacheService::DoomEntry(mCacheEntry);
@@ -506,7 +506,7 @@ nsCacheEntryDescriptor::Doom()
NS_IMETHODIMP
nsCacheEntryDescriptor::DoomAndFailPendingRequests(nsresult status)
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_DOOMANDFAILPENDINGREQUESTS));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
return NS_ERROR_NOT_IMPLEMENTED;
@@ -544,7 +544,7 @@ nsCacheEntryDescriptor::AsyncDoom(nsICacheListener *listener)
NS_IMETHODIMP
nsCacheEntryDescriptor::MarkValid()
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_MARKVALID));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
nsresult rv = nsCacheService::ValidateEntry(mCacheEntry);
@@ -559,7 +559,7 @@ nsCacheEntryDescriptor::Close()
nsTArray<RefPtr<nsInputStreamWrapper> > inputWrappers;
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_CLOSE));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
// Make sure no other stream can be opened
@@ -585,7 +585,7 @@ nsCacheEntryDescriptor::Close()
inputWrappers.Clear();
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_CLOSE));
+ nsCacheServiceAutoLock lock;
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
// XXX perhaps closing descriptors should clear/sever transports
@@ -604,7 +604,7 @@ nsCacheEntryDescriptor::GetMetaDataElement(const char *key, char **result)
NS_ENSURE_ARG_POINTER(key);
*result = nullptr;
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_GETMETADATAELEMENT));
+ nsCacheServiceAutoLock lock;
NS_ENSURE_TRUE(mCacheEntry, NS_ERROR_NOT_AVAILABLE);
const char *value;
@@ -624,7 +624,7 @@ nsCacheEntryDescriptor::SetMetaDataElement(const char *key, const char *value)
{
NS_ENSURE_ARG_POINTER(key);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_SETMETADATAELEMENT));
+ nsCacheServiceAutoLock lock;
NS_ENSURE_TRUE(mCacheEntry, NS_ERROR_NOT_AVAILABLE);
// XXX allow null value, for clearing key?
@@ -639,7 +639,7 @@ nsCacheEntryDescriptor::SetMetaDataElement(const char *key, const char *value)
NS_IMETHODIMP
nsCacheEntryDescriptor::VisitMetaData(nsICacheMetaDataVisitor * visitor)
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHEENTRYDESCRIPTOR_VISITMETADATA));
+ nsCacheServiceAutoLock lock;
// XXX check callers, we're calling out of module
NS_ENSURE_ARG_POINTER(visitor);
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
@@ -667,7 +667,7 @@ nsCacheEntryDescriptor::nsInputStreamWrapper::Release()
}
if (desc)
- nsCacheService::Lock(LOCK_TELEM(NSINPUTSTREAMWRAPPER_RELEASE));
+ nsCacheService::Lock();
nsrefcnt count;
NS_PRECONDITION(0 != mRefCnt, "dup release");
@@ -709,7 +709,7 @@ nsInputStreamWrapper::LazyInit()
if (!mDescriptor)
return NS_ERROR_NOT_AVAILABLE;
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSINPUTSTREAMWRAPPER_LAZYINIT));
+ nsCacheServiceAutoLock lock;
nsCacheAccessMode mode;
nsresult rv = mDescriptor->GetAccessGranted(&mode);
@@ -755,7 +755,7 @@ nsInputStreamWrapper::CloseInternal()
return;
}
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSINPUTSTREAMWRAPPER_CLOSEINTERNAL));
+ nsCacheServiceAutoLock lock;
if (mDescriptor) {
mDescriptor->mInputWrappers.RemoveElement(this);
@@ -859,8 +859,7 @@ nsCacheEntryDescriptor::nsDecompressInputStreamWrapper::Release()
}
if (desc)
- nsCacheService::Lock(LOCK_TELEM(
- NSDECOMPRESSINPUTSTREAMWRAPPER_RELEASE));
+ nsCacheService::Lock();
nsrefcnt count;
NS_PRECONDITION(0 != mRefCnt, "dup release");
@@ -1049,7 +1048,7 @@ nsCacheEntryDescriptor::nsOutputStreamWrapper::Release()
}
if (desc)
- nsCacheService::Lock(LOCK_TELEM(NSOUTPUTSTREAMWRAPPER_RELEASE));
+ nsCacheService::Lock();
nsrefcnt count;
NS_PRECONDITION(0 != mRefCnt, "dup release");
@@ -1089,7 +1088,7 @@ nsOutputStreamWrapper::LazyInit()
if (!mDescriptor)
return NS_ERROR_NOT_AVAILABLE;
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSOUTPUTSTREAMWRAPPER_LAZYINIT));
+ nsCacheServiceAutoLock lock;
nsCacheAccessMode mode;
nsresult rv = mDescriptor->GetAccessGranted(&mode);
@@ -1163,7 +1162,7 @@ nsOutputStreamWrapper::CloseInternal()
return;
}
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSOUTPUTSTREAMWRAPPER_CLOSEINTERNAL));
+ nsCacheServiceAutoLock lock;
if (mDescriptor) {
mDescriptor->mOutputWrapper = nullptr;
@@ -1279,7 +1278,7 @@ nsCacheEntryDescriptor::nsCompressOutputStreamWrapper::Release()
}
if (desc)
- nsCacheService::Lock(LOCK_TELEM(NSCOMPRESSOUTPUTSTREAMWRAPPER_RELEASE));
+ nsCacheService::Lock();
nsrefcnt count;
NS_PRECONDITION(0 != mRefCnt, "dup release");
diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp
index 97b1a71c8..4b08614b8 100644
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -211,7 +211,7 @@ public:
NS_IMETHOD Notify(nsITimer* aTimer) override {
if (nsCacheService::gService) {
- nsCacheServiceAutoLock autoLock(LOCK_TELEM(NSSETDISKSMARTSIZECALLBACK_NOTIFY));
+ nsCacheServiceAutoLock autoLock;
nsCacheService::gService->SetDiskSmartSize_Locked();
nsCacheService::gService->mSmartSizeTimer = nullptr;
}
@@ -295,7 +295,7 @@ public:
}
NS_IMETHOD Run() override
{
- nsCacheServiceAutoLock autoLock(LOCK_TELEM(NSBLOCKONCACHETHREADEVENT_RUN));
+ nsCacheServiceAutoLock autoLock;
CACHE_LOG_DEBUG(("nsBlockOnCacheThreadEvent [%p]\n", this));
nsCacheService::gService->mNotified = true;
nsCacheService::gService->mCondVar.Notify();
@@ -988,7 +988,7 @@ public:
NS_ASSERTION(mRequest->mListener,
"Sync OpenCacheEntry() posted to background thread!");
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSPROCESSREQUESTEVENT_RUN));
+ nsCacheServiceAutoLock lock;
rv = nsCacheService::gService->ProcessRequest(mRequest,
false,
nullptr);
@@ -1189,7 +1189,7 @@ nsCacheService::Shutdown()
nsCOMPtr<nsIFile> parentDir;
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SHUTDOWN));
+ nsCacheServiceAutoLock lock;
NS_ASSERTION(mInitialized,
"can't shutdown nsCacheService unless it has been initialized.");
if (!mInitialized)
@@ -1204,7 +1204,7 @@ nsCacheService::Shutdown()
UnregisterWeakMemoryReporter(this);
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SHUTDOWN));
+ nsCacheServiceAutoLock lock;
NS_ASSERTION(mInitialized, "Bad state");
mInitialized = false;
@@ -1363,7 +1363,7 @@ nsCacheService::EvictEntriesForClient(const char * clientID,
new EvictionNotifierRunnable(NS_ISUPPORTS_CAST(nsICacheService*, this));
NS_DispatchToMainThread(r);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_EVICTENTRIESFORCLIENT));
+ nsCacheServiceAutoLock lock;
nsresult res = NS_OK;
if (storagePolicy == nsICache::STORE_ANYWHERE ||
@@ -1412,7 +1412,7 @@ nsCacheService::IsStorageEnabledForPolicy(nsCacheStoragePolicy storagePolicy,
bool * result)
{
if (gService == nullptr) return NS_ERROR_NOT_AVAILABLE;
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_ISSTORAGEENABLEDFORPOLICY));
+ nsCacheServiceAutoLock lock;
*result = gService->IsStorageEnabledForPolicy_Locked(storagePolicy);
return NS_OK;
@@ -1466,7 +1466,7 @@ nsresult nsCacheService::VisitEntriesInternal(nsICacheVisitor *visitor)
{
NS_ENSURE_ARG_POINTER(visitor);
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_VISITENTRIES));
+ nsCacheServiceAutoLock lock;
if (!(mEnableDiskDevice || mEnableMemoryDevice))
return NS_ERROR_NOT_AVAILABLE;
@@ -1548,7 +1548,7 @@ NS_IMETHODIMP nsCacheService::GetCacheIOTarget(nsIEventTarget * *aCacheIOTarget)
// read from the main thread without the lock. This is useful to prevent
// blocking the main thread on other cache operations.
if (!NS_IsMainThread()) {
- Lock(LOCK_TELEM(NSCACHESERVICE_GETCACHEIOTARGET));
+ Lock();
}
nsresult rv;
@@ -1940,7 +1940,7 @@ nsCacheService::ProcessRequest(nsCacheRequest * request,
// XXX this is probably wrong...
Unlock();
rv = request->WaitForValidation();
- Lock(LOCK_TELEM(NSCACHESERVICE_PROCESSREQUEST));
+ Lock();
}
PR_REMOVE_AND_INIT_LINK(request);
@@ -2052,7 +2052,7 @@ nsCacheService::OpenCacheEntry(nsCacheSession * session,
}
else {
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_OPENCACHEENTRY));
+ nsCacheServiceAutoLock lock;
rv = gService->ProcessRequest(request, true, result);
// delete requests that have completed
@@ -2353,14 +2353,14 @@ nsCacheService::OnProfileShutdown()
}
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_ONPROFILESHUTDOWN));
+ nsCacheServiceAutoLock lock;
gService->mClearingEntries = true;
gService->DoomActiveEntries(nullptr);
}
gService->CloseAllStreams();
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_ONPROFILESHUTDOWN));
+ nsCacheServiceAutoLock lock;
gService->ClearDoomList();
// Make sure to wait for any pending cache-operations before
@@ -2399,7 +2399,7 @@ nsCacheService::OnProfileChanged()
CACHE_LOG_DEBUG(("nsCacheService::OnProfileChanged"));
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_ONPROFILECHANGED));
+ nsCacheServiceAutoLock lock;
gService->mEnableDiskDevice = gService->mObserver->DiskCacheEnabled();
gService->mEnableOfflineDevice = gService->mObserver->OfflineCacheEnabled();
@@ -2453,7 +2453,7 @@ void
nsCacheService::SetDiskCacheEnabled(bool enabled)
{
if (!gService) return;
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETDISKCACHEENABLED));
+ nsCacheServiceAutoLock lock;
gService->mEnableDiskDevice = enabled;
}
@@ -2462,7 +2462,7 @@ void
nsCacheService::SetDiskCacheCapacity(int32_t capacity)
{
if (!gService) return;
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETDISKCACHECAPACITY));
+ nsCacheServiceAutoLock lock;
if (gService->mDiskDevice) {
gService->mDiskDevice->SetCapacity(capacity);
@@ -2475,7 +2475,7 @@ void
nsCacheService::SetDiskCacheMaxEntrySize(int32_t maxSize)
{
if (!gService) return;
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETDISKCACHEMAXENTRYSIZE));
+ nsCacheServiceAutoLock lock;
if (gService->mDiskDevice) {
gService->mDiskDevice->SetMaxEntrySize(maxSize);
@@ -2486,7 +2486,7 @@ void
nsCacheService::SetMemoryCacheMaxEntrySize(int32_t maxSize)
{
if (!gService) return;
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETMEMORYCACHEMAXENTRYSIZE));
+ nsCacheServiceAutoLock lock;
if (gService->mMemoryDevice) {
gService->mMemoryDevice->SetMaxEntrySize(maxSize);
@@ -2497,7 +2497,7 @@ void
nsCacheService::SetOfflineCacheEnabled(bool enabled)
{
if (!gService) return;
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETOFFLINECACHEENABLED));
+ nsCacheServiceAutoLock lock;
gService->mEnableOfflineDevice = enabled;
}
@@ -2505,7 +2505,7 @@ void
nsCacheService::SetOfflineCacheCapacity(int32_t capacity)
{
if (!gService) return;
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETOFFLINECACHECAPACITY));
+ nsCacheServiceAutoLock lock;
if (gService->mOfflineDevice) {
gService->mOfflineDevice->SetCapacity(capacity);
@@ -2522,7 +2522,7 @@ nsCacheService::SetMemoryCache()
CACHE_LOG_DEBUG(("nsCacheService::SetMemoryCache"));
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETMEMORYCACHE));
+ nsCacheServiceAutoLock lock;
gService->mEnableMemoryDevice = gService->mObserver->MemoryCacheEnabled();
@@ -2638,23 +2638,6 @@ nsCacheService::Lock()
}
void
-nsCacheService::Lock(mozilla::Telemetry::ID mainThreadLockerID)
-{
- mozilla::Telemetry::ID lockerID;
- mozilla::Telemetry::ID generalID;
-
- if (NS_IsMainThread()) {
- lockerID = mainThreadLockerID;
- generalID = mozilla::Telemetry::CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_2;
- } else {
- lockerID = mozilla::Telemetry::HistogramCount;
- generalID = mozilla::Telemetry::CACHE_SERVICE_LOCK_WAIT_2;
- }
-
- nsCacheService::Lock();
-}
-
-void
nsCacheService::Unlock()
{
gService->mLock.AssertCurrentThreadOwns();
@@ -2933,7 +2916,7 @@ nsCacheService::CloseAllStreams()
nsTArray<RefPtr<nsCacheEntryDescriptor::nsOutputStreamWrapper> > outputs;
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_CLOSEALLSTREAMS));
+ nsCacheServiceAutoLock lock;
nsTArray<nsCacheEntry*> entries;
@@ -3056,7 +3039,7 @@ nsCacheService::LogCacheStatistics()
nsresult
nsCacheService::SetDiskSmartSize()
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETDISKSMARTSIZE));
+ nsCacheServiceAutoLock lock;
if (!gService) return NS_ERROR_NOT_AVAILABLE;
@@ -3175,8 +3158,7 @@ nsCacheService::CollectReports(nsIHandleReportCallback* aHandleReport,
{
size_t disk = 0;
if (mDiskDevice) {
- nsCacheServiceAutoLock
- lock(LOCK_TELEM(NSCACHESERVICE_DISKDEVICEHEAPSIZE));
+ nsCacheServiceAutoLock lock;
disk = mDiskDevice->SizeOfIncludingThis(DiskCacheDeviceMallocSizeOf);
}
diff --git a/netwerk/cache/nsCacheService.h b/netwerk/cache/nsCacheService.h
index 1751d4875..95816cfe5 100644
--- a/netwerk/cache/nsCacheService.h
+++ b/netwerk/cache/nsCacheService.h
@@ -371,9 +371,6 @@ private:
* nsCacheServiceAutoLock
******************************************************************************/
-#define LOCK_TELEM(x) \
- (::mozilla::Telemetry::CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_##x)
-
// Instantiate this class to acquire the cache service lock for a particular
// execution scope.
class nsCacheServiceAutoLock {
@@ -381,9 +378,6 @@ public:
nsCacheServiceAutoLock() {
nsCacheService::Lock();
}
- explicit nsCacheServiceAutoLock(mozilla::Telemetry::ID mainThreadLockerID) {
- nsCacheService::Lock(mainThreadLockerID);
- }
~nsCacheServiceAutoLock() {
nsCacheService::Unlock();
}
diff --git a/netwerk/cache2/CacheEntry.cpp b/netwerk/cache2/CacheEntry.cpp
index b79bf7373..51e441aa7 100644
--- a/netwerk/cache2/CacheEntry.cpp
+++ b/netwerk/cache2/CacheEntry.cpp
@@ -419,11 +419,6 @@ bool CacheEntry::Load(bool aTruncate, bool aPriority)
{
mozilla::MutexAutoUnlock unlock(mLock);
- if (reportMiss) {
- CacheFileUtils::DetailedCacheHitTelemetry::AddRecord(
- CacheFileUtils::DetailedCacheHitTelemetry::MISS, mLoadStart);
- }
-
LOG((" performing load, file=%p", mFile.get()));
if (NS_SUCCEEDED(rv)) {
rv = mFile->Init(fileKey,
@@ -458,16 +453,6 @@ NS_IMETHODIMP CacheEntry::OnFileReady(nsresult aResult, bool aIsNew)
MOZ_ASSERT(!mLoadStart.IsNull());
- if (NS_SUCCEEDED(aResult)) {
- if (aIsNew) {
- CacheFileUtils::DetailedCacheHitTelemetry::AddRecord(
- CacheFileUtils::DetailedCacheHitTelemetry::MISS, mLoadStart);
- } else {
- CacheFileUtils::DetailedCacheHitTelemetry::AddRecord(
- CacheFileUtils::DetailedCacheHitTelemetry::HIT, mLoadStart);
- }
- }
-
// OnFileReady, that is the only code that can transit from LOADING
// to any follow-on state and can only be invoked ones on an entry.
// Until this moment there is no consumer that could manipulate
diff --git a/netwerk/cache2/CacheFile.cpp b/netwerk/cache2/CacheFile.cpp
index ce771c754..69fc3d33c 100644
--- a/netwerk/cache2/CacheFile.cpp
+++ b/netwerk/cache2/CacheFile.cpp
@@ -1865,33 +1865,6 @@ CacheFile::Truncate(int64_t aOffset)
return NS_OK;
}
-static uint32_t
-StatusToTelemetryEnum(nsresult aStatus)
-{
- if (NS_SUCCEEDED(aStatus)) {
- return 0;
- }
-
- switch (aStatus) {
- case NS_BASE_STREAM_CLOSED:
- return 0; // Log this as a success
- case NS_ERROR_OUT_OF_MEMORY:
- return 2;
- case NS_ERROR_FILE_DISK_FULL:
- return 3;
- case NS_ERROR_FILE_CORRUPTED:
- return 4;
- case NS_ERROR_FILE_NOT_FOUND:
- return 5;
- case NS_BINDING_ABORTED:
- return 6;
- default:
- return 1; // other error
- }
-
- NS_NOTREACHED("We should never get here");
-}
-
nsresult
CacheFile::RemoveInput(CacheFileInputStream *aInput, nsresult aStatus)
{
diff --git a/netwerk/cache2/CacheFileIOManager.cpp b/netwerk/cache2/CacheFileIOManager.cpp
index f6b499e47..25e621d12 100644
--- a/netwerk/cache2/CacheFileIOManager.cpp
+++ b/netwerk/cache2/CacheFileIOManager.cpp
@@ -3822,44 +3822,6 @@ CacheFileIOManager::CreateCacheTree()
StartRemovingTrash();
- if (!CacheObserver::CacheFSReported()) {
- uint32_t fsType = 4; // Other OS
-
-#ifdef XP_WIN
- nsAutoString target;
- nsresult rv = mCacheDirectory->GetTarget(target);
- if (NS_FAILED(rv)) {
- return NS_OK;
- }
-
- wchar_t volume_path[MAX_PATH + 1] = { 0 };
- if (!::GetVolumePathNameW(target.get(),
- volume_path,
- mozilla::ArrayLength(volume_path))) {
- return NS_OK;
- }
-
- wchar_t fsName[6] = { 0 };
- if (!::GetVolumeInformationW(volume_path, nullptr, 0, nullptr, nullptr,
- nullptr, fsName,
- mozilla::ArrayLength(fsName))) {
- return NS_OK;
- }
-
- if (wcscmp(fsName, L"NTFS") == 0) {
- fsType = 0;
- } else if (wcscmp(fsName, L"FAT32") == 0) {
- fsType = 1;
- } else if (wcscmp(fsName, L"FAT") == 0) {
- fsType = 2;
- } else {
- fsType = 3;
- }
-#endif
-
- CacheObserver::SetCacheFSReported();
- }
-
return NS_OK;
}
@@ -3905,16 +3867,6 @@ CacheFileIOManager::OpenNSPRHandle(CacheFileHandle *aHandle, bool aCreate)
LOG(("CacheFileIOManager::OpenNSPRHandle() - Successfully evicted entry"
" with hash %08x%08x%08x%08x%08x. %s to create the new file.",
LOGSHA1(&hash), NS_SUCCEEDED(rv) ? "Succeeded" : "Failed"));
-
- // Report the full size only once per session
- static bool sSizeReported = false;
- if (!sSizeReported) {
- uint32_t cacheUsage;
- if (NS_SUCCEEDED(CacheIndex::GetCacheSize(&cacheUsage))) {
- cacheUsage >>= 10;
- sSizeReported = true;
- }
- }
} else {
LOG(("CacheFileIOManager::OpenNSPRHandle() - Couldn't evict an existing"
" entry."));
diff --git a/netwerk/cache2/CacheFileUtils.cpp b/netwerk/cache2/CacheFileUtils.cpp
index fe1a53b3d..a090a9cb1 100644
--- a/netwerk/cache2/CacheFileUtils.cpp
+++ b/netwerk/cache2/CacheFileUtils.cpp
@@ -401,101 +401,6 @@ ValidityMap::operator[](uint32_t aIdx)
return mMap.ElementAt(aIdx);
}
-StaticMutex DetailedCacheHitTelemetry::sLock;
-uint32_t DetailedCacheHitTelemetry::sRecordCnt = 0;
-DetailedCacheHitTelemetry::HitRate DetailedCacheHitTelemetry::sHRStats[kNumOfRanges];
-
-DetailedCacheHitTelemetry::HitRate::HitRate()
-{
- Reset();
-}
-
-void
-DetailedCacheHitTelemetry::HitRate::AddRecord(ERecType aType)
-{
- if (aType == HIT) {
- ++mHitCnt;
- } else {
- ++mMissCnt;
- }
-}
-
-uint32_t
-DetailedCacheHitTelemetry::HitRate::GetHitRateBucket(uint32_t aNumOfBuckets) const
-{
- uint32_t bucketIdx = (aNumOfBuckets * mHitCnt) / (mHitCnt + mMissCnt);
- if (bucketIdx == aNumOfBuckets) { // make sure 100% falls into the last bucket
- --bucketIdx;
- }
-
- return bucketIdx;
-}
-
-uint32_t
-DetailedCacheHitTelemetry::HitRate::Count()
-{
- return mHitCnt + mMissCnt;
-}
-
-void
-DetailedCacheHitTelemetry::HitRate::Reset()
-{
- mHitCnt = 0;
- mMissCnt = 0;
-}
-
-// static
-void
-DetailedCacheHitTelemetry::AddRecord(ERecType aType, TimeStamp aLoadStart)
-{
- bool isUpToDate = false;
- CacheIndex::IsUpToDate(&isUpToDate);
- if (!isUpToDate) {
- // Ignore the record when the entry file count might be incorrect
- return;
- }
-
- uint32_t entryCount;
- nsresult rv = CacheIndex::GetEntryFileCount(&entryCount);
- if (NS_FAILED(rv)) {
- return;
- }
-
- uint32_t rangeIdx = entryCount / kRangeSize;
- if (rangeIdx >= kNumOfRanges) { // The last range has no upper limit.
- rangeIdx = kNumOfRanges - 1;
- }
-
- uint32_t hitMissValue = 2 * rangeIdx; // 2 values per range
- if (aType == MISS) { // The order is HIT, MISS
- ++hitMissValue;
- }
-
- StaticMutexAutoLock lock(sLock);
-
- sHRStats[rangeIdx].AddRecord(aType);
- ++sRecordCnt;
-
- if (sRecordCnt < kTotalSamplesReportLimit) {
- return;
- }
-
- sRecordCnt = 0;
-
- for (uint32_t i = 0; i < kNumOfRanges; ++i) {
- if (sHRStats[i].Count() >= kHitRateSamplesReportLimit) {
- // The telemetry enums are grouped by buckets as follows:
- // Telemetry value : 0,1,2,3, ... ,19,20,21,22, ... ,398,399
- // Hit rate bucket : 0,0,0,0, ... , 0, 1, 1, 1, ... , 19, 19
- // Cache size range: 0,1,2,3, ... ,19, 0, 1, 2, ... , 18, 19
- uint32_t bucketOffset = sHRStats[i].GetHitRateBucket(kHitRateBuckets) *
- kNumOfRanges;
-
- sHRStats[i].Reset();
- }
- }
-}
-
void
FreeBuffer(void *aBuf) {
#ifndef NS_FREE_PERMANENT_DATA
diff --git a/netwerk/cache2/CacheFileUtils.h b/netwerk/cache2/CacheFileUtils.h
index 13acfd71d..b66f0adf1 100644
--- a/netwerk/cache2/CacheFileUtils.h
+++ b/netwerk/cache2/CacheFileUtils.h
@@ -10,7 +10,6 @@
#include "nsString.h"
#include "nsTArray.h"
#include "mozilla/StaticMutex.h"
-#include "mozilla/TimeStamp.h"
class nsILoadContextInfo;
class nsACString;
@@ -90,64 +89,6 @@ private:
nsTArray<ValidityPair> mMap;
};
-
-class DetailedCacheHitTelemetry {
-public:
- enum ERecType {
- HIT = 0,
- MISS = 1
- };
-
- static void AddRecord(ERecType aType, TimeStamp aLoadStart);
-
-private:
- class HitRate {
- public:
- HitRate();
-
- void AddRecord(ERecType aType);
- // Returns the bucket index that the current hit rate falls into according
- // to the given aNumOfBuckets.
- uint32_t GetHitRateBucket(uint32_t aNumOfBuckets) const;
- uint32_t Count();
- void Reset();
-
- private:
- uint32_t mHitCnt;
- uint32_t mMissCnt;
- };
-
- // Group the hits and misses statistics by cache files count ranges (0-5000,
- // 5001-10000, ... , 95001- )
- static const uint32_t kRangeSize = 5000;
- static const uint32_t kNumOfRanges = 20;
-
- // Use the same ranges to report an average hit rate. Report the hit rates
- // (and reset the counters) every kTotalSamplesReportLimit samples.
- static const uint32_t kTotalSamplesReportLimit = 1000;
-
- // Report hit rate for a given cache size range only if it contains
- // kHitRateSamplesReportLimit or more samples. This limit should avoid
- // reporting a biased statistics.
- static const uint32_t kHitRateSamplesReportLimit = 500;
-
- // All hit rates are accumulated in a single telemetry probe, so to use
- // a sane number of enumerated values the hit rate is divided into buckets
- // instead of using a percent value. This constant defines number of buckets
- // that we divide the hit rates into. I.e. we'll report ranges 0%-5%, 5%-10%,
- // 10-%15%, ...
- static const uint32_t kHitRateBuckets = 20;
-
- // Protects sRecordCnt and sHitStats calls.
- static StaticMutex sLock;
-
- // Counter of samples that is compared against kTotalSamplesReportLimit.
- static uint32_t sRecordCnt;
-
- // Hit rate statistics for every cache size range.
- static HitRate sHRStats[kNumOfRanges];
-};
-
void
FreeBuffer(void *aBuf);
diff --git a/netwerk/cache2/CacheIOThread.cpp b/netwerk/cache2/CacheIOThread.cpp
index d51f61b0f..2fbc0ccce 100644
--- a/netwerk/cache2/CacheIOThread.cpp
+++ b/netwerk/cache2/CacheIOThread.cpp
@@ -18,54 +18,6 @@
namespace mozilla {
namespace net {
-namespace { // anon
-
-class CacheIOTelemetry
-{
-public:
- typedef CacheIOThread::EventQueue::size_type size_type;
- static size_type mMinLengthToReport[CacheIOThread::LAST_LEVEL];
- static void Report(uint32_t aLevel, size_type aLength);
-};
-
-static CacheIOTelemetry::size_type const kGranularity = 30;
-
-CacheIOTelemetry::size_type
-CacheIOTelemetry::mMinLengthToReport[CacheIOThread::LAST_LEVEL] = {
- kGranularity, kGranularity, kGranularity, kGranularity,
- kGranularity, kGranularity, kGranularity, kGranularity
-};
-
-// static
-void CacheIOTelemetry::Report(uint32_t aLevel, CacheIOTelemetry::size_type aLength)
-{
- if (mMinLengthToReport[aLevel] > aLength) {
- return;
- }
-
- static Telemetry::ID telemetryID[] = {
- Telemetry::HTTP_CACHE_IO_QUEUE_2_OPEN_PRIORITY,
- Telemetry::HTTP_CACHE_IO_QUEUE_2_READ_PRIORITY,
- Telemetry::HTTP_CACHE_IO_QUEUE_2_MANAGEMENT,
- Telemetry::HTTP_CACHE_IO_QUEUE_2_OPEN,
- Telemetry::HTTP_CACHE_IO_QUEUE_2_READ,
- Telemetry::HTTP_CACHE_IO_QUEUE_2_WRITE_PRIORITY,
- Telemetry::HTTP_CACHE_IO_QUEUE_2_WRITE,
- Telemetry::HTTP_CACHE_IO_QUEUE_2_INDEX,
- Telemetry::HTTP_CACHE_IO_QUEUE_2_EVICT
- };
-
- // Each bucket is a multiply of kGranularity (30, 60, 90..., 300+)
- aLength = (aLength / kGranularity);
- // Next time report only when over the current length + kGranularity
- mMinLengthToReport[aLevel] = (aLength + 1) * kGranularity;
-
- // 10 is number of buckets we have in each probe
- aLength = std::min<size_type>(aLength, 10);
-}
-
-} // anon
-
namespace detail {
/**
@@ -525,7 +477,6 @@ void CacheIOThread::LoopOneLevel(uint32_t aLevel)
mCurrentlyExecutingLevel = aLevel;
bool returnEvents = false;
- bool reportTelementry = true;
EventQueue::size_type index;
{
@@ -539,11 +490,6 @@ void CacheIOThread::LoopOneLevel(uint32_t aLevel)
break;
}
- if (reportTelementry) {
- reportTelementry = false;
- CacheIOTelemetry::Report(aLevel, length);
- }
-
// Drop any previous flagging, only an event on the current level may set
// this flag.
mRerunCurrentEvent = false;
diff --git a/netwerk/cache2/CacheIndex.cpp b/netwerk/cache2/CacheIndex.cpp
index 1009aeaf8..2c6451d72 100644
--- a/netwerk/cache2/CacheIndex.cpp
+++ b/netwerk/cache2/CacheIndex.cpp
@@ -20,7 +20,6 @@
#include "nsITimer.h"
#include "mozilla/AutoRestore.h"
#include <algorithm>
-#include "mozilla/Telemetry.h"
#include "mozilla/Unused.h"
@@ -1295,29 +1294,6 @@ CacheIndex::GetCacheSize(uint32_t *_retval)
// static
nsresult
-CacheIndex::GetEntryFileCount(uint32_t *_retval)
-{
- LOG(("CacheIndex::GetEntryFileCount()"));
-
- StaticMutexAutoLock lock(sLock);
-
- RefPtr<CacheIndex> index = gInstance;
-
- if (!index) {
- return NS_ERROR_NOT_INITIALIZED;
- }
-
- if (!index->IsIndexUsable()) {
- return NS_ERROR_NOT_AVAILABLE;
- }
-
- *_retval = index->mIndexStats.ActiveEntriesCount();
- LOG(("CacheIndex::GetEntryFileCount() - returning %u", *_retval));
- return NS_OK;
-}
-
-// static
-nsresult
CacheIndex::GetCacheStats(nsILoadContextInfo *aInfo, uint32_t *aSize, uint32_t *aCount)
{
LOG(("CacheIndex::GetCacheStats() [info=%p]", aInfo));
@@ -3167,11 +3143,6 @@ CacheIndex::ChangeState(EState aNewState)
return;
}
- if ((mState == READING || mState == BUILDING || mState == UPDATING) &&
- aNewState == READY) {
- ReportHashStats();
- }
-
// Try to evict entries over limit everytime we're leaving state READING,
// BUILDING or UPDATING, but not during shutdown or when removing all
// entries.
@@ -3720,75 +3691,6 @@ CacheIndex::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf)
return mallocSizeOf(gInstance) + SizeOfExcludingThis(mallocSizeOf);
}
-namespace {
-
-class HashComparator
-{
-public:
- bool Equals(CacheIndexRecord* a, CacheIndexRecord* b) const {
- return memcmp(&a->mHash, &b->mHash, sizeof(SHA1Sum::Hash)) == 0;
- }
- bool LessThan(CacheIndexRecord* a, CacheIndexRecord* b) const {
- return memcmp(&a->mHash, &b->mHash, sizeof(SHA1Sum::Hash)) < 0;
- }
-};
-
-void
-ReportHashSizeMatch(const SHA1Sum::Hash *aHash1, const SHA1Sum::Hash *aHash2)
-{
- const uint32_t *h1 = reinterpret_cast<const uint32_t *>(aHash1);
- const uint32_t *h2 = reinterpret_cast<const uint32_t *>(aHash2);
-
- for (uint32_t i = 0; i < 5; ++i) {
- if (h1[i] != h2[i]) {
- uint32_t bitsDiff = h1[i] ^ h2[i];
- bitsDiff = NetworkEndian::readUint32(&bitsDiff);
-
- // count leading zeros in bitsDiff
- static const uint8_t debruijn32[32] =
- { 0, 31, 9, 30, 3, 8, 13, 29, 2, 5, 7, 21, 12, 24, 28, 19,
- 1, 10, 4, 14, 6, 22, 25, 20, 11, 15, 23, 26, 16, 27, 17, 18};
-
- bitsDiff |= bitsDiff>>1;
- bitsDiff |= bitsDiff>>2;
- bitsDiff |= bitsDiff>>4;
- bitsDiff |= bitsDiff>>8;
- bitsDiff |= bitsDiff>>16;
- bitsDiff++;
-
- uint8_t hashSizeMatch = debruijn32[bitsDiff*0x076be629>>27] + (i<<5);
-
- return;
- }
- }
-
- MOZ_ASSERT(false, "Found a collision in the index!");
-}
-
-} // namespace
-
-void
-CacheIndex::ReportHashStats()
-{
- // We're gathering the hash stats only once, exclude too small caches.
- if (CacheObserver::HashStatsReported() || mFrecencyArray.Length() < 15000) {
- return;
- }
-
- nsTArray<CacheIndexRecord *> records;
- for (auto iter = mFrecencyArray.Iter(); !iter.Done(); iter.Next()) {
- records.AppendElement(iter.Get());
- }
-
- records.Sort(HashComparator());
-
- for (uint32_t i = 1; i < records.Length(); i++) {
- ReportHashSizeMatch(&records[i-1]->mHash, &records[i]->mHash);
- }
-
- CacheObserver::SetHashStatsReported();
-}
-
// static
void
CacheIndex::OnAsyncEviction(bool aEvicting)
diff --git a/netwerk/cache2/CacheIndex.h b/netwerk/cache2/CacheIndex.h
index dc72c346f..acb3bdd25 100644
--- a/netwerk/cache2/CacheIndex.h
+++ b/netwerk/cache2/CacheIndex.h
@@ -662,9 +662,6 @@ public:
// Returns cache size in kB.
static nsresult GetCacheSize(uint32_t *_retval);
- // Returns number of entry files in the cache
- static nsresult GetEntryFileCount(uint32_t *_retval);
-
// Synchronously returns the disk occupation and number of entries per-context.
// Callable on any thread.
static nsresult GetCacheStats(nsILoadContextInfo *aInfo, uint32_t *aSize, uint32_t *aCount);
@@ -918,8 +915,6 @@ private:
// Memory reporting (private part)
size_t SizeOfExcludingThisInternal(mozilla::MallocSizeOf mallocSizeOf) const;
- void ReportHashStats();
-
static mozilla::StaticRefPtr<CacheIndex> gInstance;
static StaticMutex sLock;
diff --git a/netwerk/cache2/CacheObserver.cpp b/netwerk/cache2/CacheObserver.cpp
index 6b6d89395..32e0dff95 100644
--- a/netwerk/cache2/CacheObserver.cpp
+++ b/netwerk/cache2/CacheObserver.cpp
@@ -86,12 +86,6 @@ bool CacheObserver::sSanitizeOnShutdown = kDefaultSanitizeOnShutdown;
static bool kDefaultClearCacheOnShutdown = false;
bool CacheObserver::sClearCacheOnShutdown = kDefaultClearCacheOnShutdown;
-static bool kDefaultCacheFSReported = false;
-bool CacheObserver::sCacheFSReported = kDefaultCacheFSReported;
-
-static bool kDefaultHashStatsReported = false;
-bool CacheObserver::sHashStatsReported = kDefaultHashStatsReported;
-
static uint32_t const kDefaultMaxShutdownIOLag = 2; // seconds
Atomic<uint32_t, Relaxed> CacheObserver::sMaxShutdownIOLag(kDefaultMaxShutdownIOLag);
@@ -331,58 +325,6 @@ CacheObserver::StoreDiskCacheCapacity()
}
// static
-void
-CacheObserver::SetCacheFSReported()
-{
- sCacheFSReported = true;
-
- if (!sSelf) {
- return;
- }
-
- if (NS_IsMainThread()) {
- sSelf->StoreCacheFSReported();
- } else {
- nsCOMPtr<nsIRunnable> event =
- NewRunnableMethod(sSelf, &CacheObserver::StoreCacheFSReported);
- NS_DispatchToMainThread(event);
- }
-}
-
-void
-CacheObserver::StoreCacheFSReported()
-{
- mozilla::Preferences::SetInt("browser.cache.disk.filesystem_reported",
- sCacheFSReported);
-}
-
-// static
-void
-CacheObserver::SetHashStatsReported()
-{
- sHashStatsReported = true;
-
- if (!sSelf) {
- return;
- }
-
- if (NS_IsMainThread()) {
- sSelf->StoreHashStatsReported();
- } else {
- nsCOMPtr<nsIRunnable> event =
- NewRunnableMethod(sSelf, &CacheObserver::StoreHashStatsReported);
- NS_DispatchToMainThread(event);
- }
-}
-
-void
-CacheObserver::StoreHashStatsReported()
-{
- mozilla::Preferences::SetInt("browser.cache.disk.hashstats_reported",
- sHashStatsReported);
-}
-
-// static
void CacheObserver::ParentDirOverride(nsIFile** aDir)
{
if (NS_WARN_IF(!aDir))
diff --git a/netwerk/cache2/CacheObserver.h b/netwerk/cache2/CacheObserver.h
index 62e5bbc6e..ccdd89030 100644
--- a/netwerk/cache2/CacheObserver.h
+++ b/netwerk/cache2/CacheObserver.h
@@ -61,12 +61,6 @@ class CacheObserver : public nsIObserver
{ return sHalfLifeExperiment; }
static bool ClearCacheOnShutdown()
{ return sSanitizeOnShutdown && sClearCacheOnShutdown; }
- static bool CacheFSReported()
- { return sCacheFSReported; }
- static void SetCacheFSReported();
- static bool HashStatsReported()
- { return sHashStatsReported; }
- static void SetHashStatsReported();
static void ParentDirOverride(nsIFile ** aDir);
static bool EntryIsTooBig(int64_t aSize, bool aUsingDisk);
@@ -82,8 +76,6 @@ private:
static CacheObserver* sSelf;
void StoreDiskCacheCapacity();
- void StoreCacheFSReported();
- void StoreHashStatsReported();
void AttachToPreferences();
static uint32_t sUseNewCache;
@@ -106,8 +98,6 @@ private:
static int32_t sHalfLifeExperiment;
static bool sSanitizeOnShutdown;
static bool sClearCacheOnShutdown;
- static bool sCacheFSReported;
- static bool sHashStatsReported;
static Atomic<uint32_t, Relaxed> sMaxShutdownIOLag;
static Atomic<PRIntervalTime> sShutdownDemandedTime;
diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp
index ea54dbd61..7bc5abcd1 100644
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -3311,13 +3311,6 @@ nsCookieService::SetCookieInternal(nsIURI *aHostURI,
// so we can handle them separately.
bool newCookie = ParseAttributes(aCookieHeader, cookieAttributes);
- // Collect telemetry on how often secure cookies are set from non-secure
- // origins, and vice-versa.
- //
- // 0 = nonsecure and "http:"
- // 1 = nonsecure and "https:"
- // 2 = secure and "http:"
- // 3 = secure and "https:"
bool isHTTPS;
nsresult rv = aHostURI->SchemeIs("https", &isHTTPS);
diff --git a/netwerk/protocol/http/Http2Compression.cpp b/netwerk/protocol/http/Http2Compression.cpp
index 64fd05a17..9206f8b4c 100644
--- a/netwerk/protocol/http/Http2Compression.cpp
+++ b/netwerk/protocol/http/Http2Compression.cpp
@@ -402,7 +402,7 @@ Http2Decompressor::DecodeHeaderBlock(const uint8_t *data, uint32_t datalen,
nsresult rv = NS_OK;
nsresult softfail_rv = NS_OK;
- while (NS_SUCCEEDED(rv) && (mOffset < datalen)) {
+ while (NS_SUCCEEDED(rv) && (mOffset < mDataLen)) {
bool modifiesTable = true;
if (mData[mOffset] & 0x80) {
rv = DoIndexed();
@@ -684,6 +684,11 @@ nsresult
Http2Decompressor::DecodeFinalHuffmanCharacter(const HuffmanIncomingTable *table,
uint8_t &c, uint8_t &bitsLeft)
{
+ MOZ_ASSERT(mOffset <= mDataLen);
+ if (mOffset > mDataLen) {
+ NS_WARNING("DecodeFinalHuffmanCharacter trying to read beyond end of buffer");
+ return NS_ERROR_FAILURE;
+ }
uint8_t mask = (1 << bitsLeft) - 1;
uint8_t idx = mData[mOffset - 1] & mask;
idx <<= (8 - bitsLeft);
@@ -721,6 +726,7 @@ Http2Decompressor::DecodeFinalHuffmanCharacter(const HuffmanIncomingTable *table
uint8_t
Http2Decompressor::ExtractByte(uint8_t bitsLeft, uint32_t &bytesConsumed)
{
+ MOZ_DIAGNOSTIC_ASSERT(mOffset < mDataLen);
uint8_t rv;
if (bitsLeft) {
@@ -750,8 +756,8 @@ Http2Decompressor::DecodeHuffmanCharacter(const HuffmanIncomingTable *table,
uint8_t idx = ExtractByte(bitsLeft, bytesConsumed);
if (table->IndexHasANextTable(idx)) {
- if (bytesConsumed >= mDataLen) {
- if (!bitsLeft || (bytesConsumed > mDataLen)) {
+ if (mOffset >= mDataLen) {
+ if (!bitsLeft || (mOffset > mDataLen)) {
// TODO - does this get me into trouble in the new world?
// No info left in input to try to consume, we're done
LOG(("DecodeHuffmanCharacter all out of bits to consume, can't chain"));
@@ -892,6 +898,13 @@ Http2Decompressor::DoLiteralInternal(nsACString &name, nsACString &value,
return rv;
}
+ // sanity check
+ if (mOffset >= mDataLen) {
+ NS_WARNING("Http2 Decompressor ran out of data");
+ // This is session-fatal
+ return NS_ERROR_FAILURE;
+ }
+
bool isHuffmanEncoded;
if (!index) {
@@ -919,6 +932,13 @@ Http2Decompressor::DoLiteralInternal(nsACString &name, nsACString &value,
return rv;
}
+ // sanity check
+ if (mOffset >= mDataLen) {
+ NS_WARNING("Http2 Decompressor ran out of data");
+ // This is session-fatal
+ return NS_ERROR_FAILURE;
+ }
+
// now the value
uint32_t valueLen;
isHuffmanEncoded = mData[mOffset] & (1 << 7);
diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp
index f2a91c589..ebc430f8c 100644
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -276,6 +276,7 @@ DataChannelConnection::Destroy()
LOG(("Deregistered %p from the SCTP stack.", static_cast<void *>(this)));
}
+ mListener = nullptr;
// Finish Destroy on STS thread to avoid bug 876167 - once that's fixed,
// the usrsctp_close() calls can move back here (and just proxy the
// disconnect_all())
diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
index 0414c4841..29fea8bfb 100644
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -146,7 +146,14 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
nsAutoCString baseUri, titleUri;
rv = uri->GetAsciiSpec(baseUri);
if (NS_FAILED(rv)) return rv;
- titleUri = baseUri;
+
+ nsCOMPtr<nsIURI> titleURL;
+ rv = uri->Clone(getter_AddRefs(titleURL));
+ if (NS_FAILED(rv)) titleURL = uri;
+ rv = titleURL->SetQuery(EmptyCString());
+ if (NS_FAILED(rv)) titleURL = uri;
+ rv = titleURL->SetRef(EmptyCString());
+ if (NS_FAILED(rv)) titleURL = uri;
nsCString parentStr;
@@ -170,16 +177,14 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
// that - see above
nsAutoCString pw;
- rv = uri->GetPassword(pw);
+ rv = titleURL->GetPassword(pw);
if (NS_FAILED(rv)) return rv;
if (!pw.IsEmpty()) {
nsCOMPtr<nsIURI> newUri;
- rv = uri->Clone(getter_AddRefs(newUri));
+ rv = titleURL->Clone(getter_AddRefs(newUri));
if (NS_FAILED(rv)) return rv;
rv = newUri->SetPassword(EmptyCString());
if (NS_FAILED(rv)) return rv;
- rv = newUri->GetAsciiSpec(titleUri);
- if (NS_FAILED(rv)) return rv;
}
nsAutoCString path;
@@ -247,6 +252,11 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
}
}
+ rv = titleURL->GetAsciiSpec(titleUri);
+ if (NS_FAILED(rv)) {
+ return rv;
+ }
+
buffer.AppendLiteral("<style type=\"text/css\">\n"
":root {\n"
" font-family: sans-serif;\n"