Bug 2063717, part 1 - Replace uses of services::GetIOService(), ::GetChromeRegistry() and ::GetPermissionManager(). r=xpcom-reviewers,media-playback-reviewers,emilio,padenot
The new method is more threadsafe, but it will acquire a lock. Hopefully none of this is super hot code. Differential Revision: https://phabricator.services.mozilla.com/D318838
This commit is contained in:
committed by
amccreight@mozilla.com
parent
92739c61b2
commit
26a008e61a
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "nsChromeProtocolHandler.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "nsChromeRegistry.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
@@ -93,7 +94,8 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
if (!nsChromeRegistry::gChromeRegistry) {
|
||||
// We don't actually want this ref, we just want the service to
|
||||
// initialize if it hasn't already.
|
||||
nsCOMPtr<nsIChromeRegistry> reg = mozilla::services::GetChromeRegistry();
|
||||
nsCOMPtr<nsIChromeRegistry> reg =
|
||||
mozilla::components::ChromeRegistry::Service();
|
||||
NS_ENSURE_TRUE(nsChromeRegistry::gChromeRegistry, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "FetchParent.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/SchedulerGroup.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/ClientInfo.h"
|
||||
@@ -716,7 +717,7 @@ nsresult FetchService::RegisterNetworkObserver() {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIIOService> ioService = services::GetIOService();
|
||||
nsCOMPtr<nsIIOService> ioService = components::IO::Service();
|
||||
if (!ioService) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "MediaStatusManager.h"
|
||||
|
||||
#include "MediaControlService.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/StaticPrefs_media.h"
|
||||
#include "mozilla/dom/CanonicalBrowsingContext.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
@@ -268,7 +269,8 @@ nsString MediaStatusManager::GetDefaultFaviconURL() const {
|
||||
// Convert URI from `chrome://XXX` to `file://XXX` because we would like to
|
||||
// let OS related frameworks, such as SMTC and MPRIS, handle this URL in order
|
||||
// to show the icon on virtual controller interface.
|
||||
nsCOMPtr<nsIChromeRegistry> regService = services::GetChromeRegistry();
|
||||
nsCOMPtr<nsIChromeRegistry> regService =
|
||||
components::ChromeRegistry::Service();
|
||||
if (!regService) {
|
||||
return u""_ns;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "mozilla/URLPreloader.h"
|
||||
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
#include "mozilla/IOBuffers.h"
|
||||
@@ -12,7 +13,6 @@
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/scache/StartupCache.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Try.h"
|
||||
#include "mozilla/Vector.h"
|
||||
|
||||
@@ -132,7 +132,7 @@ Result<Ok, nsresult> URLPreloader::InitInternal() {
|
||||
mResProto = do_QueryInterface(ph, &rv);
|
||||
MOZ_TRY(rv);
|
||||
|
||||
mChromeReg = services::GetChromeRegistry();
|
||||
mChromeReg = components::ChromeRegistry::Service();
|
||||
if (!mChromeReg) {
|
||||
return Err(NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "nsStringStream.h"
|
||||
#include "StartupCacheUtils.h"
|
||||
#include "mozilla/scache/StartupCache.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/Omnijar.h"
|
||||
|
||||
namespace mozilla {
|
||||
@@ -163,7 +164,7 @@ nsresult ResolveURI(nsIURI* in, nsIURI** out) {
|
||||
}
|
||||
if (scheme.EqualsLiteral("chrome")) {
|
||||
nsCOMPtr<nsIChromeRegistry> chromeReg =
|
||||
mozilla::services::GetChromeRegistry();
|
||||
mozilla::components::ChromeRegistry::Service();
|
||||
if (!chromeReg) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
return chromeReg->ConvertChromeURL(in, out);
|
||||
|
||||
@@ -2000,7 +2000,7 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
||||
bool nsExternalAppHandler::IsDownloadSpam(nsIChannel* aChannel) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
mozilla::services::GetPermissionManager();
|
||||
mozilla::components::PermissionManager::Service();
|
||||
nsCOMPtr<nsIPrincipal> principal = loadInfo->TriggeringPrincipal();
|
||||
bool exactHostMatch = false;
|
||||
constexpr auto type = "automatic-download"_ns;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# include "mozilla/BackgroundTasks.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsConsoleMessage.h"
|
||||
#include "nsIConsoleService.h"
|
||||
@@ -634,7 +634,8 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
|
||||
}
|
||||
|
||||
if (!nsChromeRegistry::gChromeRegistry) {
|
||||
nsCOMPtr<nsIChromeRegistry> cr = mozilla::services::GetChromeRegistry();
|
||||
nsCOMPtr<nsIChromeRegistry> cr =
|
||||
mozilla::components::ChromeRegistry::Service();
|
||||
if (!nsChromeRegistry::gChromeRegistry) {
|
||||
LogMessageWithContext(aFile, line,
|
||||
"Chrome registry isn't available yet.");
|
||||
|
||||
Reference in New Issue
Block a user