summaryrefslogtreecommitdiffstats
path: root/netwerk/cache/nsCacheService.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'netwerk/cache/nsCacheService.cpp')
-rw-r--r--netwerk/cache/nsCacheService.cpp57
1 files changed, 24 insertions, 33 deletions
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);
}