diff options
-rw-r--r-- | application/palemoon/components/statusbar/Status.jsm | 20 | ||||
-rw-r--r-- | application/palemoon/components/statusbar/Status4Evar.jsm | 45 | ||||
-rw-r--r-- | application/palemoon/components/statusbar/content-thunk.js | 23 | ||||
-rw-r--r-- | application/palemoon/components/statusbar/moz.build | 1 | ||||
-rw-r--r-- | dom/media/AudioStream.cpp | 3 | ||||
-rw-r--r-- | dom/media/CubebUtils.cpp | 25 | ||||
-rw-r--r-- | dom/media/CubebUtils.h | 2 | ||||
-rw-r--r-- | dom/media/GraphDriver.cpp | 10 | ||||
-rw-r--r-- | netwerk/cache/nsCacheEntryDescriptor.cpp | 83 | ||||
-rw-r--r-- | netwerk/cache/nsCacheService.cpp | 66 | ||||
-rw-r--r-- | netwerk/cache/nsCacheService.h | 6 | ||||
-rw-r--r-- | netwerk/cache2/CacheFile.cpp | 27 | ||||
-rw-r--r-- | xpcom/base/CycleCollectedJSContext.cpp | 1 | ||||
-rw-r--r-- | xpcom/base/nsCycleCollector.cpp | 2 |
14 files changed, 135 insertions, 179 deletions
diff --git a/application/palemoon/components/statusbar/Status.jsm b/application/palemoon/components/statusbar/Status.jsm index d888c7d94..19e12ddfd 100644 --- a/application/palemoon/components/statusbar/Status.jsm +++ b/application/palemoon/components/statusbar/Status.jsm @@ -35,7 +35,7 @@ S4EStatusService.prototype = _defaultStatus: { val: "", type: "" }, _isFullScreen: false, - _isFullScreenVideo: false, + _isVideo: false, _statusText: { val: "", type: "" }, _noUpdate: false, @@ -222,18 +222,10 @@ S4EStatusService.prototype = } }, - updateFullScreen: function() + setFullScreenState: function(isFullScreen, isVideo) { - this._isFullScreen = this._window.fullScreen; - this._isFullScreenVideo = false; - if(this._isFullScreen) - { - let fsEl = this._window.content.document.mozFullScreenElement; - if(fsEl && (fsEl.nodeName == "VIDEO" || fsEl.getElementsByTagName("VIDEO").length > 0)) - { - this._isFullScreenVideo = true; - } - } + this._isFullScreen = isFullScreen; + this._isVideo = isFullScreen && isVideo; this.clearStatusField(); this.updateStatusField(true); @@ -305,7 +297,7 @@ S4EStatusService.prototype = let label = null; - if(this._isFullScreen && this._service.advancedStatusDetectFullScreen) + if(this._isFullScreen) { switch(location) { @@ -330,7 +322,7 @@ S4EStatusService.prototype = break; case 3: // Popup default: - if(this._isFullScreenVideo && this._service.advancedStatusDetectVideo) + if(this._isVideo) { return; } diff --git a/application/palemoon/components/statusbar/Status4Evar.jsm b/application/palemoon/components/statusbar/Status4Evar.jsm index 055306a88..6400f2e2a 100644 --- a/application/palemoon/components/statusbar/Status4Evar.jsm +++ b/application/palemoon/components/statusbar/Status4Evar.jsm @@ -31,7 +31,7 @@ function Status4Evar(window, gBrowser, toolbox) this.statusService = new S4EStatusService(this._window, s4e_service, this.getters); this.progressMeter = new S4EProgressService(gBrowser, s4e_service, this.getters, this.statusService); this.downloadStatus = new S4EDownloadService(this._window, gBrowser, s4e_service, this.getters); - this.sizeModeService = new SizeModeService(this._window, this); + this.sizeModeService = new SizeModeService(this._window, gBrowser, this); this._window.addEventListener("unload", this, false); } @@ -232,20 +232,31 @@ S4EWindowGetters.prototype = } }; -function SizeModeService(window, s4e) +function SizeModeService(window, gBrowser, s4e) { this._window = window; + this._gBrowser = gBrowser; this._s4e = s4e; + this._mm = this._window.messageManager; this.lastFullScreen = this._window.fullScreen; this.lastwindowState = this._window.windowState; + + if(s4e_service.advancedStatusDetectFullScreen) + { + this._mm.addMessageListener("status4evar@caligonstudios.com:video-detect-answer", this) + this._mm.loadFrameScript("resource:///modules/statusbar/content-thunk.js", true); + } + this._window.addEventListener("sizemodechange", this, false); } SizeModeService.prototype = { _window: null, + _gBrowser: null, _s4e: null, + _mm: null, lastFullScreen: null, lastwindowState: null, @@ -254,7 +265,13 @@ SizeModeService.prototype = { this._window.removeEventListener("sizemodechange", this, false); - ["_window", "_s4e"].forEach(function(prop) + if(s4e_service.advancedStatusDetectFullScreen) + { + this._mm.removeDelayedFrameScript("resource:///modules/statusbar/content-thunk.js"); + this._mm.removeMessageListener("status4evar@caligonstudios.com:video-detect-answer", this); + } + + ["_window", "_gBrowser", "_s4e", "_mm"].forEach(function(prop) { delete this[prop]; }, this); @@ -262,10 +279,18 @@ SizeModeService.prototype = handleEvent: function(e) { - if(this._window.fullScreen != this.lastFullScreen) + if(this._window.fullScreen != this.lastFullScreen && s4e_service.advancedStatusDetectFullScreen) { this.lastFullScreen = this._window.fullScreen; - this._s4e.statusService.updateFullScreen(); + + if(this.lastFullScreen && s4e_service.advancedStatusDetectVideo) + { + this._gBrowser.selectedBrowser.messageManager.sendAsyncMessage("status4evar@caligonstudios.com:video-detect"); + } + else + { + this._s4e.statusService.setFullScreenState(this.lastFullScreen, false); + } } if(this._window.windowState != this.lastwindowState) @@ -275,5 +300,13 @@ SizeModeService.prototype = } }, - QueryInterface: XPCOMUtils.generateQI([ CI.nsIDOMEventListener ]) + receiveMessage: function(message) + { + if(message.name == "status4evar@caligonstudios.com:video-detect-answer") + { + this._s4e.statusService.setFullScreenState(this.lastFullScreen, message.data.isVideo); + } + }, + + QueryInterface: XPCOMUtils.generateQI([ CI.nsIDOMEventListener, CI.nsIMessageListener ]) }; diff --git a/application/palemoon/components/statusbar/content-thunk.js b/application/palemoon/components/statusbar/content-thunk.js new file mode 100644 index 000000000..fe1fbabad --- /dev/null +++ b/application/palemoon/components/statusbar/content-thunk.js @@ -0,0 +1,23 @@ +/* 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/. */ + +function handleVideoDetect(message) +{ + let isVideo = false; + + let fsEl = content.document.mozFullScreenElement; + if(fsEl) + { + isVideo = ( + fsEl.nodeName == "VIDEO" + || (fsEl.nodeName == "IFRAME" && fsEl.contentDocument && fsEl.contentDocument.getElementsByTagName("VIDEO").length > 0) + || fsEl.getElementsByTagName("VIDEO").length > 0 + ); + } + + sendAsyncMessage("status4evar@caligonstudios.com:video-detect-answer", {isVideo: isVideo}); +} + +addMessageListener("status4evar@caligonstudios.com:video-detect", handleVideoDetect); + diff --git a/application/palemoon/components/statusbar/moz.build b/application/palemoon/components/statusbar/moz.build index ba8cfef86..0f7f597a5 100644 --- a/application/palemoon/components/statusbar/moz.build +++ b/application/palemoon/components/statusbar/moz.build @@ -16,6 +16,7 @@ EXTRA_COMPONENTS += [ ] EXTRA_JS_MODULES.statusbar = [ + 'content-thunk.js', 'Downloads.jsm', 'Progress.jsm', 'Status.jsm', diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp index 896dee407..4b1d82c37 100644 --- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -345,7 +345,6 @@ AudioStream::Init(uint32_t aNumChannels, uint32_t aRate, cubeb* cubebContext = CubebUtils::GetCubebContext(); if (!cubebContext) { NS_WARNING("Can't get cubeb context!"); - CubebUtils::ReportCubebStreamInitFailure(true); return NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR; } @@ -367,10 +366,8 @@ AudioStream::OpenCubeb(cubeb* aContext, cubeb_stream_params& aParams, latency_frames, DataCallback_S, StateCallback_S, this) == CUBEB_OK) { mCubebStream.reset(stream); - CubebUtils::ReportCubebBackendUsed(); } else { NS_WARNING(nsPrintfCString("AudioStream::OpenCubeb() %p failed to init cubeb", this).get()); - CubebUtils::ReportCubebStreamInitFailure(aIsFirst); return NS_ERROR_FAILURE; } diff --git a/dom/media/CubebUtils.cpp b/dom/media/CubebUtils.cpp index 93792e63b..0f0167d9c 100644 --- a/dom/media/CubebUtils.cpp +++ b/dom/media/CubebUtils.cpp @@ -239,31 +239,6 @@ cubeb* GetCubebContextUnlocked() return sCubebContext; } -void ReportCubebBackendUsed() -{ - StaticMutexAutoLock lock(sMutex); - - sAudioStreamInitEverSucceeded = true; - - bool foundBackend = false; - for (uint32_t i = 0; i < ArrayLength(AUDIOSTREAM_BACKEND_ID_STR); i++) { - if (!strcmp(cubeb_get_backend_id(sCubebContext), AUDIOSTREAM_BACKEND_ID_STR[i])) { - foundBackend = true; - } - } -} - -void ReportCubebStreamInitFailure(bool aIsFirst) -{ - StaticMutexAutoLock lock(sMutex); - if (!aIsFirst && !sAudioStreamInitEverSucceeded) { - // This machine has no audio hardware, or it's in really bad shape, don't - // send this info, since we want CUBEB_BACKEND_INIT_FAILURE_OTHER to detect - // failures to open multiple streams in a process over time. - return; - } -} - uint32_t GetCubebPlaybackLatencyInMilliseconds() { StaticMutexAutoLock lock(sMutex); diff --git a/dom/media/CubebUtils.h b/dom/media/CubebUtils.h index fa5fc2294..f43492374 100644 --- a/dom/media/CubebUtils.h +++ b/dom/media/CubebUtils.h @@ -35,8 +35,6 @@ double GetVolumeScale(); bool GetFirstStream(); cubeb* GetCubebContext(); cubeb* GetCubebContextUnlocked(); -void ReportCubebStreamInitFailure(bool aIsFirstStream); -void ReportCubebBackendUsed(); uint32_t GetCubebPlaybackLatencyInMilliseconds(); Maybe<uint32_t> GetCubebMSGLatencyInFrames(); bool CubebLatencyPrefSet(); diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 47762c56e..b60dfee9d 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -623,9 +623,6 @@ AudioCallbackDriver::Init() cubeb* cubebContext = CubebUtils::GetCubebContext(); if (!cubebContext) { NS_WARNING("Could not get cubeb context."); - if (!mFromFallback) { - CubebUtils::ReportCubebStreamInitFailure(true); - } return; } @@ -710,18 +707,11 @@ AudioCallbackDriver::Init() NS_WARNING_ASSERTION( rv == CUBEB_OK, "Could not set the audio stream volume in GraphDriver.cpp"); - CubebUtils::ReportCubebBackendUsed(); } else { #ifdef MOZ_WEBRTC StaticMutexAutoUnlock unlock(AudioInputCubeb::Mutex()); #endif NS_WARNING("Could not create a cubeb stream for MediaStreamGraph, falling back to a SystemClockDriver"); - // Only report failures when we're not coming from a driver that was - // created itself as a fallback driver because of a previous audio driver - // failure. - if (!mFromFallback) { - CubebUtils::ReportCubebStreamInitFailure(firstStream); - } // Fall back to a driver using a normal thread. If needed, // the graph will try to re-open an audio stream later. MonitorAutoLock lock(GraphImpl()->GetMonitor()); 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/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/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp index 02fc1aa4c..206984656 100644 --- a/xpcom/base/CycleCollectedJSContext.cpp +++ b/xpcom/base/CycleCollectedJSContext.cpp @@ -1537,7 +1537,6 @@ IncrementalFinalizeRunnable::Run() return NS_OK; } - TimeStamp start = TimeStamp::Now(); ReleaseNow(true); if (mDeferredFinalizeFunctions.Length()) { diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index a349e086d..7109d85bd 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -3524,9 +3524,9 @@ nsCycleCollector::CleanupAfterCollection() mGraph.Clear(); timeLog.Checkpoint("CleanupAfterCollection::mGraph.Clear()"); +#ifdef COLLECT_TIME_DEBUG uint32_t interval = (uint32_t)((TimeStamp::Now() - mCollectionStart).ToMilliseconds()); -#ifdef COLLECT_TIME_DEBUG printf("cc: total cycle collector time was %ums in %u slices\n", interval, mResults.mNumSlices); printf("cc: visited %u ref counted and %u GCed objects, freed %d ref counted and %d GCed objects", |