summaryrefslogtreecommitdiffstats
path: root/netwerk
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-10-01 11:31:29 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-10-01 11:31:29 +0200
commitec4c6dd42abcbf6fd081ce3da1dbf1b5ea9c0d8f (patch)
treeb021c360a3b092a802d42827cf8416790cbd7ab2 /netwerk
parentd718e32b522ebc06f3093df72a3409a3d2fe046e (diff)
downloadUXP-ec4c6dd42abcbf6fd081ce3da1dbf1b5ea9c0d8f.tar
UXP-ec4c6dd42abcbf6fd081ce3da1dbf1b5ea9c0d8f.tar.gz
UXP-ec4c6dd42abcbf6fd081ce3da1dbf1b5ea9c0d8f.tar.lz
UXP-ec4c6dd42abcbf6fd081ce3da1dbf1b5ea9c0d8f.tar.xz
UXP-ec4c6dd42abcbf6fd081ce3da1dbf1b5ea9c0d8f.zip
Remove telemetry from cache v1 service locking (part2).
- Fold Lock(TelemetryID) into Lock(); - Fold nsCacheServiceAutoLock(TelemetryID) into nsCacheServiceAutoLock(); Tag #21.
Diffstat (limited to 'netwerk')
-rw-r--r--netwerk/cache/nsCacheEntryDescriptor.cpp83
-rw-r--r--netwerk/cache/nsCacheService.cpp57
-rw-r--r--netwerk/cache/nsCacheService.h6
3 files changed, 65 insertions, 81 deletions
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 414887970..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,14 +2638,6 @@ nsCacheService::Lock()
}
void
-nsCacheService::Lock(mozilla::Telemetry::ID mainThreadLockerID)
-{
- // Telemetry data removed.
- // XXX: Fold into nsCacheService::Lock()
- nsCacheService::Lock();
-}
-
-void
nsCacheService::Unlock()
{
gService->mLock.AssertCurrentThreadOwns();
@@ -2924,7 +2916,7 @@ nsCacheService::CloseAllStreams()
nsTArray<RefPtr<nsCacheEntryDescriptor::nsOutputStreamWrapper> > outputs;
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_CLOSEALLSTREAMS));
+ nsCacheServiceAutoLock lock;
nsTArray<nsCacheEntry*> entries;
@@ -3047,7 +3039,7 @@ nsCacheService::LogCacheStatistics()
nsresult
nsCacheService::SetDiskSmartSize()
{
- nsCacheServiceAutoLock lock(LOCK_TELEM(NSCACHESERVICE_SETDISKSMARTSIZE));
+ nsCacheServiceAutoLock lock;
if (!gService) return NS_ERROR_NOT_AVAILABLE;
@@ -3166,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();
}