Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj

This commit is contained in:
Juan Gomez 2015-06-24 14:11:00 -04:00
parent 557d2b582a
commit 98461fc4a4
201 changed files with 506 additions and 579 deletions

View File

@ -1260,7 +1260,7 @@ nsAccessibilityService::Init()
logging::CheckEnv();
#endif
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
gApplicationAccessible = new ApplicationAccessibleWrap();
else
gApplicationAccessible = new ApplicationAccessible();
@ -1281,7 +1281,7 @@ nsAccessibilityService::Init()
gIsShutdown = false;
// Now its safe to start platform accessibility.
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
PlatformInit();
return true;
@ -1324,7 +1324,7 @@ nsAccessibilityService::Shutdown()
gIsShutdown = true;
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
PlatformShutdown();
gApplicationAccessible->Shutdown();

View File

@ -282,7 +282,7 @@ IPCAccessibilityActive()
#ifdef MOZ_B2G
return false;
#else
return XRE_GetProcessType() == GeckoProcessType_Content &&
return XRE_IsContentProcess() &&
mozilla::Preferences::GetBool("accessibility.ipc_architecture.enabled", true);
#endif
}

View File

@ -425,7 +425,7 @@ nsCoreUtils::IsTabDocument(nsIDocument* aDocumentNode)
treeItem->GetParent(getter_AddRefs(parentTreeItem));
// Tab document running in own process doesn't have parent.
if (XRE_GetProcessType() == GeckoProcessType_Content)
if (XRE_IsContentProcess())
return !parentTreeItem;
// Parent of docshell for tab document running in chrome process is root.

View File

@ -64,7 +64,7 @@ nsWinUtils::MaybeStartWindowEmulation()
if (Compatibility::IsJAWS() || Compatibility::IsWE() ||
Compatibility::IsDolphin() ||
XRE_GetProcessType() == GeckoProcessType_Content) {
XRE_IsContentProcess()) {
RegisterNativeWindow(kClassNameTabContent);
sHWNDCache = new nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>(2);
return true;

View File

@ -22,7 +22,7 @@ static nsresult
BroadcastDomainSetChange(DomainSetType aSetType, DomainSetChangeType aChangeType,
nsIURI* aDomain = nullptr)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default,
MOZ_ASSERT(XRE_IsParentProcess(),
"DomainPolicy should only be exposed to the chrome process.");
nsTArray<ContentParent*> parents;
@ -45,7 +45,7 @@ DomainPolicy::DomainPolicy() : mBlacklist(new DomainSet(BLACKLIST))
, mWhitelist(new DomainSet(WHITELIST))
, mSuperWhitelist(new DomainSet(SUPER_WHITELIST))
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
BroadcastDomainSetChange(NO_TYPE, ACTIVATE_POLICY);
}
}
@ -112,7 +112,7 @@ DomainPolicy::Deactivate()
if (ssm) {
ssm->DeactivateDomainPolicy();
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
BroadcastDomainSetChange(NO_TYPE, DEACTIVATE_POLICY);
}
return NS_OK;
@ -170,7 +170,7 @@ DomainSet::Add(nsIURI* aDomain)
nsCOMPtr<nsIURI> clone = GetCanonicalClone(aDomain);
NS_ENSURE_TRUE(clone, NS_ERROR_FAILURE);
mHashTable.PutEntry(clone);
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
return BroadcastDomainSetChange(mType, ADD_DOMAIN, aDomain);
return NS_OK;
@ -182,7 +182,7 @@ DomainSet::Remove(nsIURI* aDomain)
nsCOMPtr<nsIURI> clone = GetCanonicalClone(aDomain);
NS_ENSURE_TRUE(clone, NS_ERROR_FAILURE);
mHashTable.RemoveEntry(clone);
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
return BroadcastDomainSetChange(mType, REMOVE_DOMAIN, aDomain);
return NS_OK;
@ -192,7 +192,7 @@ NS_IMETHODIMP
DomainSet::Clear()
{
mHashTable.Clear();
if (XRE_GetProcessType() == GeckoProcessType_Default)
if (XRE_IsParentProcess())
return BroadcastDomainSetChange(mType, CLEAR_DOMAINS);
return NS_OK;

View File

@ -1285,7 +1285,7 @@ nsScriptSecurityManager::~nsScriptSecurityManager(void)
// ContentChild might hold a reference to the domain policy,
// and it might release it only after the security manager is
// gone. But we can still assert this for the main process.
MOZ_ASSERT_IF(XRE_GetProcessType() == GeckoProcessType_Default,
MOZ_ASSERT_IF(XRE_IsParentProcess(),
!mDomainPolicy);
}
@ -1502,7 +1502,7 @@ nsScriptSecurityManager::GetDomainPolicyActive(bool *aRv)
NS_IMETHODIMP
nsScriptSecurityManager::ActivateDomainPolicy(nsIDomainPolicy** aRv)
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return NS_ERROR_SERVICE_NOT_AVAILABLE;
}

View File

@ -416,7 +416,7 @@ nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
}
keyword.Trim(" ");
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (!contentChild) {
return NS_ERROR_NOT_AVAILABLE;

View File

@ -824,7 +824,7 @@ IncreasePrivateDocShellCount()
{
gNumberOfPrivateDocShells++;
if (gNumberOfPrivateDocShells > 1 ||
XRE_GetProcessType() != GeckoProcessType_Content) {
!XRE_IsContentProcess()) {
return;
}
@ -838,7 +838,7 @@ DecreasePrivateDocShellCount()
MOZ_ASSERT(gNumberOfPrivateDocShells > 0);
gNumberOfPrivateDocShells--;
if (!gNumberOfPrivateDocShells) {
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
dom::ContentChild* cc = dom::ContentChild::GetSingleton();
cc->SendPrivateDocShellsExist(false);
return;
@ -5021,7 +5021,7 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
mInPrivateBrowsing ? nsISocketProvider::NO_PERMANENT_STORAGE : 0;
bool isStsHost = false;
bool isPinnedHost = false;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsISiteSecurityService> sss =
do_GetService(NS_SSSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
@ -9449,7 +9449,7 @@ nsDocShell::CopyFavicon(nsIURI* aOldURI,
nsIURI* aNewURI,
bool aInPrivateBrowsing)
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (contentChild) {
mozilla::ipc::URIParams oldURI, newURI;
@ -13991,7 +13991,7 @@ nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
return;
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (contentChild) {
contentChild->SendNotifyKeywordSearchLoading(aProvider, aKeyword);

View File

@ -59,12 +59,6 @@ namespace asmjscache {
namespace {
bool
IsMainProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Default;
}
// Anything smaller should compile fast enough that caching will just add
// overhead.
static const size_t sMinCachedModuleLength = 10000;
@ -503,7 +497,7 @@ public:
mIsApp(false),
mEnforcingQuota(true)
{
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(XRE_IsParentProcess());
}
virtual ~MainProcessRunnable()
@ -1133,7 +1127,7 @@ public:
: MainProcessRunnable(aPrincipal, aOpenMode, aWriteParams),
mReadParams(aReadParams)
{
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(!NS_IsMainThread());
MOZ_COUNT_CTOR(SingleProcessRunnable);
}
@ -1211,7 +1205,7 @@ public:
mOpened(false),
mFinished(false)
{
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
MOZ_COUNT_CTOR(ParentProcessRunnable);
}
@ -1388,7 +1382,7 @@ public:
mActorDestroyed(false),
mState(eInitial)
{
MOZ_ASSERT(!IsMainProcess());
MOZ_ASSERT(!XRE_IsParentProcess());
MOZ_ASSERT(!NS_IsMainThread());
MOZ_COUNT_CTOR(ChildProcessRunnable);
}
@ -1584,7 +1578,7 @@ OpenFile(nsIPrincipal* aPrincipal,
// parent process to open the file and interact with the QuotaManager. The
// child can then map the file into its address space to perform I/O.
nsRefPtr<File> file;
if (IsMainProcess()) {
if (XRE_IsParentProcess()) {
file = new SingleProcessRunnable(aPrincipal, aOpenMode, aWriteParams,
aReadParams);
} else {

View File

@ -70,7 +70,7 @@ AudioChannelService::GetAudioChannelService()
{
MOZ_ASSERT(NS_IsMainThread());
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return AudioChannelServiceChild::GetAudioChannelService();
}
@ -84,7 +84,7 @@ AudioChannelService::GetOrCreateAudioChannelService()
{
MOZ_ASSERT(NS_IsMainThread());
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return AudioChannelServiceChild::GetOrCreateAudioChannelService();
}
@ -104,7 +104,7 @@ AudioChannelService::GetOrCreateAudioChannelService()
void
AudioChannelService::Shutdown()
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return AudioChannelServiceChild::Shutdown();
}
@ -122,7 +122,7 @@ AudioChannelService::AudioChannelService()
, mDisabled(false)
, mDefChannelChildID(CONTENT_PROCESS_ID_UNKNOWN)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->AddObserver(this, "ipc:content-shutdown", false);
@ -180,7 +180,7 @@ AudioChannelService::RegisterType(AudioChannel aChannel, uint64_t aChildID,
AudioChannelInternalType type = GetInternalType(aChannel, true);
mChannelCounters[type].AppendElement(aChildID);
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// We must keep the childIds in order to decide which app is allowed to play
// with then telephony channel.
@ -272,7 +272,7 @@ AudioChannelService::UnregisterType(AudioChannel aChannel,
// There are two reasons to defer the decrease of telephony channel.
// 1. User can have time to remove device from his ear before music resuming.
// 2. Give BT SCO to be disconnected before starting to connect A2DP.
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
if (aChannel == AudioChannel::Telephony) {
UnregisterTelephonyChild(aChildID);
@ -306,7 +306,7 @@ AudioChannelService::UnregisterTypeInternal(AudioChannel aChannel,
// In order to avoid race conditions, it's safer to notify any existing
// agent any time a new one is registered.
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// No hidden content channel is playable if the original playable hidden
// process does not need to play audio from background anymore.
if (aChannel == AudioChannel::Content &&
@ -547,7 +547,7 @@ AudioChannelService::SetDefaultVolumeControlChannelInternal(int32_t aChannel,
bool aVisible,
uint64_t aChildID)
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return;
}
@ -590,7 +590,7 @@ AudioChannelService::SetDefaultVolumeControlChannelInternal(int32_t aChannel,
void
AudioChannelService::SendAudioChannelChangedNotification(uint64_t aChildID)
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return;
}

View File

@ -91,7 +91,7 @@ Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
uint8_t* data = aArray.Data();
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
InfallibleTArray<uint8_t> randomValues;
// Tell the parent process to generate random values via PContent
ContentChild* cc = ContentChild::GetSingleton();

View File

@ -1481,7 +1481,7 @@ Navigator::GetFeature(const nsAString& aName, ErrorResult& aRv)
#if defined(XP_LINUX)
if (aName.EqualsLiteral("hardware.memory")) {
// with seccomp enabled, fopen() should be in a non-sandboxed process
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
uint32_t memLevel = mozilla::hal::GetTotalSystemMemoryLevel();
if (memLevel == 0) {
p->MaybeReject(NS_ERROR_NOT_AVAILABLE);
@ -2572,7 +2572,7 @@ Navigator::HasTVSupport(JSContext* aCx, JSObject* aGlobal)
bool
Navigator::IsE10sEnabled(JSContext* aCx, JSObject* aGlobal)
{
return XRE_GetProcessType() == GeckoProcessType_Content;
return XRE_IsContentProcess();
}
bool

View File

@ -140,7 +140,7 @@ static void
MarkMessageManagers()
{
// The global message manager only exists in the root process.
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return;
}
nsCOMPtr<nsIMessageBroadcaster> strongGlobalMM =

View File

@ -336,7 +336,7 @@ nsContentPermissionUtils::AskPermission(nsIContentPermissionRequest* aRequest, n
NS_ENSURE_STATE(aWindow && aWindow->IsCurrentInnerWindow());
// for content process
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
nsRefPtr<RemotePermissionRequest> req =
new RemotePermissionRequest(aRequest, aWindow);

View File

@ -10603,7 +10603,7 @@ PLDHashOperator UnlockEnumerator(imgIRequest* aKey,
nsresult
nsDocument::SetImageLockingState(bool aLocked)
{
if (XRE_GetProcessType() == GeckoProcessType_Content &&
if (XRE_IsContentProcess() &&
!Preferences::GetBool("image.mem.allow_locking_in_content_processes", true)) {
return NS_OK;
}

View File

@ -697,7 +697,7 @@ nsFocusManager::WindowRaised(nsIDOMWindow* aWindow)
// If this is a parent or single process window, send the activate event.
// Events for child process windows will be sent when ParentActivated
// is called.
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
ActivateOrDeactivate(window, true);
}
@ -760,7 +760,7 @@ nsFocusManager::WindowLowered(nsIDOMWindow* aWindow)
// If this is a parent or single process window, send the deactivate event.
// Events for child process windows will be sent when ParentActivated
// is called.
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
ActivateOrDeactivate(window, false);
}

View File

@ -1601,12 +1601,12 @@ nsFrameLoader::ShouldUseRemoteProcess()
// Don't try to launch nested children if we don't have OMTC.
// They won't render!
if (XRE_GetProcessType() == GeckoProcessType_Content &&
if (XRE_IsContentProcess() &&
!CompositorChild::ChildProcessHasCompositor()) {
return false;
}
if (XRE_GetProcessType() == GeckoProcessType_Content &&
if (XRE_IsContentProcess() &&
!(PR_GetEnv("MOZ_NESTED_OOP_TABS") ||
Preferences::GetBool("dom.ipc.tabs.nested.enabled", false))) {
return false;
@ -2650,7 +2650,7 @@ nsFrameLoader::ResetPermissionManagerStatus()
{
// The resetting of the permissions status can run only
// in the main process.
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
return;
}

View File

@ -903,7 +903,7 @@ nsFrameMessageManager::Dump(const nsAString& aStr)
NS_IMETHODIMP
nsFrameMessageManager::PrivateNoteIntentionalCrash()
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
mozilla::NoteIntentionalCrash("tab");
return NS_OK;
} else {
@ -1577,7 +1577,7 @@ MessageManagerReporter::CollectReports(nsIMemoryReporterCallback* aCb,
{
nsresult rv;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIMessageBroadcaster> globalmm =
do_GetService("@mozilla.org/globalmessagemanager;1");
if (globalmm) {
@ -1613,7 +1613,7 @@ MessageManagerReporter::CollectReports(nsIMemoryReporterCallback* aCb,
nsresult
NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult)
{
NS_ENSURE_TRUE(XRE_GetProcessType() == GeckoProcessType_Default,
NS_ENSURE_TRUE(XRE_IsParentProcess(),
NS_ERROR_NOT_AVAILABLE);
nsRefPtr<nsFrameMessageManager> mm = new nsFrameMessageManager(nullptr,
nullptr,
@ -2151,7 +2151,7 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
"Re-creating sChildProcessManager");
MessageManagerCallback* cb;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
cb = new SameChildProcessMessageManagerCallback();
} else {
cb = new ChildProcessMessageManagerCallback();

View File

@ -8987,7 +8987,7 @@ nsGlobalWindow::ShowModalDialog(const nsAString& aUrl, nsIVariant* aArgument,
(aUrl, aArgument, aOptions, aError), aError,
nullptr);
if (!IsShowModalDialogEnabled() || XRE_GetProcessType() == GeckoProcessType_Content) {
if (!IsShowModalDialogEnabled() || XRE_IsContentProcess()) {
aError.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}
@ -10772,7 +10772,7 @@ nsGlobalWindow::ShowSlowScriptDialog()
unsigned lineno;
bool hasFrame = JS::DescribeScriptedCaller(cx, &filename, &lineno);
if (XRE_GetProcessType() == GeckoProcessType_Content &&
if (XRE_IsContentProcess() &&
ProcessHangMonitor::Get()) {
ProcessHangMonitor::SlowScriptAction action;
nsRefPtr<ProcessHangMonitor> monitor = ProcessHangMonitor::Get();

View File

@ -3199,7 +3199,7 @@ nsObjectLoadingContent::ShouldPlay(FallbackType &aReason, bool aIgnoreCurrentTyp
sPrefsInitialized = true;
}
if (XRE_GetProcessType() == GeckoProcessType_Default &&
if (XRE_IsParentProcess() &&
BrowserTabsRemoteAutostart()) {
// Plugins running OOP from the chrome process along with plugins running
// OOP from the content process will hang. Let's prevent that situation.

View File

@ -534,7 +534,7 @@ nsWindowMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
// Collect window memory usage.
nsWindowSizes windowTotalSizes(nullptr);
nsCOMPtr<amIAddonManager> addonManager;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// Only try to access the service from the main process.
addonManager = do_GetService("@mozilla.org/addons/integration;1");
}

View File

@ -2946,7 +2946,7 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
if (scheme.LowerCaseEqualsLiteral("app") ||
scheme.LowerCaseEqualsLiteral("jar")) {
mIsMappedArrayBuffer = true;
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIJARChannel> jarChannel = do_QueryInterface(mChannel);
// For memory mapping from child process, we need to get file
// descriptor of the JAR file opened remotely on the parent proess.

View File

@ -333,10 +333,4 @@ DispatchStatusChangedEvent(const nsAString& aType,
#endif
}
bool
IsMainProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Default;
}
END_BLUETOOTH_NAMESPACE

View File

@ -157,14 +157,6 @@ DispatchStatusChangedEvent(const nsAString& aType,
const nsAString& aDeviceAddress,
bool aStatus);
/**
* Check whether the caller runs at B2G process.
*
* @return true if the caller runs at B2G process, false otherwise.
*/
bool
IsMainProcess();
END_BLUETOOTH_NAMESPACE
#endif

View File

@ -784,7 +784,7 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
return nullptr;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// In-process transfer
bs->SendFile(aDeviceAddress, &aBlob, results);
} else {

View File

@ -98,12 +98,6 @@ StaticRefPtr<BluetoothService> sBluetoothService;
bool sInShutdown = false;
bool sToggleInProgress = false;
bool
IsMainProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Default;
}
void
ShutdownTimeExceeded(nsITimer* aTimer, void* aClosure)
{
@ -220,7 +214,7 @@ BluetoothService*
BluetoothService::Create()
{
#if defined(MOZ_B2G_BT)
if (!IsMainProcess()) {
if (!XRE_IsParentProcess()) {
return BluetoothServiceChildProcess::Create();
}
@ -254,7 +248,7 @@ BluetoothService::Init()
}
// Only the main process should observe bluetooth settings changes.
if (IsMainProcess() &&
if (XRE_IsParentProcess() &&
NS_FAILED(obs->AddObserver(this, MOZSETTINGS_CHANGED_ID, false))) {
BT_WARNING("Failed to add settings change observer!");
return false;

View File

@ -1298,7 +1298,7 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
return nullptr;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// In-process transfer
bs->SendFile(aDeviceAddress, &aBlob, results);
} else {

View File

@ -193,7 +193,7 @@ BluetoothService*
BluetoothService::Create()
{
#if defined(MOZ_B2G_BT)
if (!IsMainProcess()) {
if (!XRE_IsParentProcess()) {
return BluetoothServiceChildProcess::Create();
}
@ -227,7 +227,7 @@ BluetoothService::Init()
}
// Only the main process should observe bluetooth settings changes.
if (IsMainProcess() &&
if (XRE_IsParentProcess() &&
NS_FAILED(obs->AddObserver(this, MOZSETTINGS_CHANGED_ID, false))) {
BT_WARNING("Failed to add settings change observer!");
return false;
@ -269,7 +269,7 @@ BluetoothService::RegisterBluetoothSignalHandler(
// Distribute pending pairing requests when pairing listener has been added
// to signal observer table.
if (IsMainProcess() &&
if (XRE_IsParentProcess() &&
!mPendingPairReqSignals.IsEmpty() &&
aNodeName.EqualsLiteral(KEY_PAIRING_LISTENER)) {
for (uint32_t i = 0; i < mPendingPairReqSignals.Length(); ++i) {

View File

@ -443,7 +443,7 @@ bool
BluetoothHfpManager::Init()
{
// The function must run at b2g process since it would access SettingsService.
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();

View File

@ -152,7 +152,7 @@ NS_CreateCellBroadcastService()
{
nsCOMPtr<nsICellBroadcastService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
service = new mozilla::dom::cellbroadcast::CellBroadcastIPCService();
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
} else {

View File

@ -51,8 +51,8 @@
#include "nsXULAppAPI.h"
#define ASSERT_PARENT_PROCESS() \
AssertIsInMainProcess(); \
if (NS_WARN_IF(!IsMainProcess())) { \
MOZ_ASSERT(XRE_IsParentProcess()); \
if (NS_WARN_IF(!XRE_IsParentProcess())) { \
return NS_ERROR_FAILURE; \
}
@ -125,20 +125,6 @@ static uint64_t gCounterID = 0;
typedef nsClassHashtable<nsUint32HashKey, DataStoreInfo> HashApp;
bool
IsMainProcess()
{
static const bool isMainProcess =
XRE_GetProcessType() == GeckoProcessType_Default;
return isMainProcess;
}
void
AssertIsInMainProcess()
{
MOZ_ASSERT(IsMainProcess());
}
void
RejectPromise(nsPIDOMWindow* aWindow, Promise* aPromise, nsresult aRv)
{
@ -161,8 +147,7 @@ void
DeleteDatabase(const nsAString& aName,
const nsAString& aManifestURL)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsRefPtr<DataStoreDB> db = new DataStoreDB(aManifestURL, aName);
db->Delete();
@ -174,8 +159,7 @@ DeleteDataStoresAppEnumerator(
nsAutoPtr<DataStoreInfo>& aInfo,
void* aUserData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
auto* appId = static_cast<uint32_t*>(aUserData);
if (*appId != aAppId) {
@ -191,8 +175,7 @@ DeleteDataStoresEnumerator(const nsAString& aName,
nsAutoPtr<HashApp>& aApps,
void* aUserData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
aApps->Enumerate(DeleteDataStoresAppEnumerator, aUserData);
return aApps->Count() ? PL_DHASH_NEXT : PL_DHASH_REMOVE;
@ -215,8 +198,7 @@ ResetPermission(uint32_t aAppId, const nsAString& aOriginURL,
const nsAString& aPermission,
bool aReadOnly)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsresult rv;
nsCOMPtr<nsIIOService> ioService(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
@ -347,8 +329,7 @@ GetDataStoreInfosEnumerator(const uint32_t& aAppId,
DataStoreInfo* aInfo,
void* aUserData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
auto* data = static_cast<GetDataStoreInfosData*>(aUserData);
if (aAppId == data->mAppId) {
@ -384,8 +365,7 @@ GetAppManifestURLsEnumerator(const uint32_t& aAppId,
DataStoreInfo* aInfo,
void* aUserData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
auto* manifestURLs = static_cast<nsIMutableArray*>(aUserData);
nsCOMPtr<nsISupportsString> manifestURL(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
@ -417,8 +397,7 @@ AddPermissionsEnumerator(const uint32_t& aAppId,
DataStoreInfo* aInfo,
void* userData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
auto* data = static_cast<AddPermissionsData*>(userData);
@ -457,8 +436,7 @@ AddAccessPermissionsEnumerator(const uint32_t& aAppId,
DataStoreInfo* aInfo,
void* userData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
auto* data = static_cast<AddAccessPermissionsData*>(userData);
@ -517,15 +495,13 @@ public:
, mName(aName)
, mManifestURL(aManifestURL)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
}
void
Run(const nsAString& aRevisionId)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsRefPtr<DataStoreService> service = DataStoreService::Get();
MOZ_ASSERT(service);
@ -553,15 +529,13 @@ public:
, mName(aName)
, mManifestURL(aManifestURL)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
}
void
Run(DataStoreDB* aDb, RunStatus aStatus) override
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
MOZ_ASSERT(aDb);
if (aStatus == Error) {
@ -642,8 +616,7 @@ public:
NS_IMETHOD
HandleEvent(nsIDOMEvent* aEvent) override
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsRefPtr<IDBRequest> request;
request.swap(mRequest);
@ -830,7 +803,7 @@ DataStoreService::Shutdown()
MOZ_ASSERT(NS_IsMainThread());
if (gDataStoreService) {
if (IsMainProcess()) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->RemoveObserver(gDataStoreService, "webapps-clear-data");
@ -863,7 +836,7 @@ DataStoreService::~DataStoreService()
nsresult
DataStoreService::Init()
{
if (!IsMainProcess()) {
if (!XRE_IsParentProcess()) {
return NS_OK;
}
@ -973,7 +946,7 @@ DataStoreService::GetDataStores(nsIDOMWindow* aWindow,
// If this request comes from the main process, we have access to the
// window, so we can skip the ipc communication.
if (IsMainProcess()) {
if (XRE_IsParentProcess()) {
uint32_t appId;
nsresult rv = principal->GetAppId(&appId);
if (NS_FAILED(rv)) {
@ -1132,8 +1105,7 @@ DataStoreService::GetDataStoreInfos(const nsAString& aName,
nsIPrincipal* aPrincipal,
nsTArray<DataStoreInfo>& aStores)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsCOMPtr<nsIAppsService> appsService =
do_GetService("@mozilla.org/AppsService;1");
@ -1242,8 +1214,7 @@ DataStoreService::CheckPermission(nsIPrincipal* aPrincipal,
void
DataStoreService::DeleteDataStores(uint32_t aAppId)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
mStores.Enumerate(DeleteDataStoresEnumerator, &aAppId);
mAccessStores.Enumerate(DeleteDataStoresEnumerator, &aAppId);
@ -1254,8 +1225,7 @@ DataStoreService::Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
if (strcmp(aTopic, "webapps-clear-data")) {
return NS_OK;
@ -1294,8 +1264,7 @@ DataStoreService::AddPermissions(uint32_t aAppId,
const nsAString& aManifestURL,
bool aReadOnly)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
// This is the permission name.
nsString permission;
@ -1327,8 +1296,7 @@ DataStoreService::AddAccessPermissions(uint32_t aAppId, const nsAString& aName,
const nsAString& aManifestURL,
bool aReadOnly)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
// When an app wants to have access to a DataStore, the permissions must be
// set.
@ -1349,8 +1317,7 @@ DataStoreService::CreateFirstRevisionId(uint32_t aAppId,
const nsAString& aName,
const nsAString& aManifestURL)
{
AssertIsInMainProcess();
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
nsRefPtr<DataStoreDB> db = new DataStoreDB(aManifestURL, aName);
@ -1380,7 +1347,7 @@ DataStoreService::EnableDataStore(uint32_t aAppId, const nsAString& aName,
}
// Notify the child processes.
if (IsMainProcess()) {
if (XRE_IsParentProcess()) {
nsTArray<ContentParent*> children;
ContentParent::GetAll(children);
for (uint32_t i = 0; i < children.Length(); i++) {
@ -1447,8 +1414,7 @@ DataStoreService::GetDataStoresFromIPC(const nsAString& aName,
nsIPrincipal* aPrincipal,
nsTArray<DataStoreSetting>* aValue)
{
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() && NS_IsMainThread());
uint32_t appId;
nsresult rv = aPrincipal->GetAppId(&appId);

View File

@ -561,7 +561,7 @@ FileUpdateDispatcher::Observe(nsISupports* aSubject,
return NS_OK;
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
// Child process. Forward the notification to the parent.
ContentChild::GetSingleton()
->SendFilePathUpdateNotify(dsf->mStorageType,
@ -692,7 +692,7 @@ DeviceStorageFile::Dump(const char* label)
path = NS_LITERAL_STRING("(null)");
}
const char* ptStr;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
ptStr = "parent";
} else {
ptStr = "child";
@ -814,7 +814,7 @@ OverrideRootDir::Init()
}
if (sDirs->overrideRootDir) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// Only the parent process can create directories. In testing, because
// the preference is updated after startup, its entirely possible that
// the preference updated notification will be received by a child
@ -936,7 +936,7 @@ InitDirs()
}
#endif
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
NS_GetSpecialDirectory("UAppData", getter_AddRefs(sDirs->crashes));
if (sDirs->crashes) {
sDirs->crashes->Append(NS_LITERAL_STRING("Crash Reports"));
@ -2058,7 +2058,7 @@ ContinueCursorEvent::~ContinueCursorEvent() {}
void
ContinueCursorEvent::Continue()
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
DebugOnly<nsresult> rv = NS_DispatchToMainThread(this);
MOZ_ASSERT(NS_SUCCEEDED(rv));
return;
@ -2244,7 +2244,7 @@ nsDOMDeviceStorageCursor::Allow(JS::HandleValue aChoices)
return NS_DispatchToMainThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(this, mFile);
DeviceStorageEnumerationParams params(mFile->mStorageType,
@ -3013,7 +3013,7 @@ public:
return NS_DispatchToCurrentThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
DeviceStorageCreateFdParams params;
params.type() = mFile->mStorageType;
@ -3053,7 +3053,7 @@ public:
return NS_DispatchToCurrentThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
BlobChild* actor
= ContentChild::GetSingleton()->GetOrCreateActorForBlob(
static_cast<Blob*>(mBlob.get()));
@ -3099,7 +3099,7 @@ public:
return NS_DispatchToCurrentThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
BlobChild* actor
= ContentChild::GetSingleton()->GetOrCreateActorForBlob(
static_cast<Blob*>(mBlob.get()));
@ -3145,7 +3145,7 @@ public:
return NS_DispatchToCurrentThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageGetParams params(mFile->mStorageType,
@ -3179,7 +3179,7 @@ public:
return NS_DispatchToCurrentThread(r);
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageDeleteParams params(mFile->mStorageType,
@ -3195,7 +3195,7 @@ public:
case DEVICE_STORAGE_REQUEST_FREE_SPACE:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageFreeSpaceParams params(mFile->mStorageType,
@ -3210,7 +3210,7 @@ public:
case DEVICE_STORAGE_REQUEST_USED_SPACE:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageUsedSpaceParams params(mFile->mStorageType,
@ -3231,7 +3231,7 @@ public:
case DEVICE_STORAGE_REQUEST_AVAILABLE:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageAvailableParams params(mFile->mStorageType,
@ -3246,7 +3246,7 @@ public:
case DEVICE_STORAGE_REQUEST_STATUS:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageStatusParams params(mFile->mStorageType,
@ -3267,7 +3267,7 @@ public:
case DEVICE_STORAGE_REQUEST_FORMAT:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageFormatParams params(mFile->mStorageType,
@ -3282,7 +3282,7 @@ public:
case DEVICE_STORAGE_REQUEST_MOUNT:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageMountParams params(mFile->mStorageType,
@ -3297,7 +3297,7 @@ public:
case DEVICE_STORAGE_REQUEST_UNMOUNT:
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
PDeviceStorageRequestChild* child
= new DeviceStorageRequestChild(mRequest, mFile);
DeviceStorageUnmountParams params(mFile->mStorageType,

View File

@ -597,7 +597,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
// window edge) wont update the cursor if the cached value and the current
// cursor match. So when the mouse exits a remote frame, clear the cached
// widget cursor so a proper update will occur when the mouse re-enters.
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
ClearCachedWidgetCursor(mCurrentTarget);
}

View File

@ -928,7 +928,7 @@ IMEStateManager::SetIMEState(const IMEState& aState,
// XXX I think that we should use nsContentUtils::IsCallerChrome() instead
// of the process type.
if (aAction.mCause == InputContextAction::CAUSE_UNKNOWN &&
XRE_GetProcessType() != GeckoProcessType_Content) {
!XRE_IsContentProcess()) {
aAction.mCause = InputContextAction::CAUSE_UNKNOWN_CHROME;
}

View File

@ -242,7 +242,7 @@ void
FileInputStreamWrapper::Serialize(InputStreamParams& aParams,
FileDescriptorArray& /* aFDs */)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIInputStream> thisStream = do_QueryObject(this);

View File

@ -39,7 +39,7 @@ CreateDirectoryTask::CreateDirectoryTask(
FileSystemRequestParent* aParent)
: FileSystemTaskBase(aFileSystem, aParam, aParent)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem);
@ -84,7 +84,7 @@ CreateDirectoryTask::SetSuccessRequestResult(const FileSystemResponseValue& aVal
nsresult
CreateDirectoryTask::Work()
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");

View File

@ -39,7 +39,7 @@ CreateFileTask::CreateFileTask(FileSystemBase* aFileSystem,
MOZ_ASSERT(aFileSystem);
GetOutputBufferSize();
if (aBlobData) {
if (FileSystemUtils::IsParentProcess()) {
if (XRE_IsParentProcess()) {
aBlobData->GetInternalStream(getter_AddRefs(mBlobStream), aRv);
NS_WARN_IF(aRv.Failed());
} else {
@ -61,7 +61,7 @@ CreateFileTask::CreateFileTask(FileSystemBase* aFileSystem,
: FileSystemTaskBase(aFileSystem, aParam, aParent)
, mReplace(false)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem);
@ -168,7 +168,7 @@ CreateFileTask::Work()
nsCOMPtr<nsIOutputStream> mStream;
};
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");
@ -324,7 +324,7 @@ CreateFileTask::GetPermissionAccessType(nsCString& aAccess) const
void
CreateFileTask::GetOutputBufferSize() const
{
if (sOutputBufferSize || !FileSystemUtils::IsParentProcess()) {
if (sOutputBufferSize || !XRE_IsParentProcess()) {
return;
}
sOutputBufferSize =

View File

@ -47,7 +47,7 @@ DeviceStorageFileSystem::DeviceStorageFileSystem(
// Get the local path of the file system root.
// Since the child process is not allowed to access the file system, we only
// do this from the parent process.
if (!FileSystemUtils::IsParentProcess()) {
if (!XRE_IsParentProcess()) {
return;
}
nsCOMPtr<nsIFile> rootFile;
@ -100,7 +100,7 @@ DeviceStorageFileSystem::GetWindow() const
already_AddRefed<nsIFile>
DeviceStorageFileSystem::GetLocalFile(const nsAString& aRealPath) const
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Should be on parent process!");
nsAutoString localPath;
FileSystemUtils::NormalizedPathToLocalPath(aRealPath, localPath);
@ -116,7 +116,7 @@ DeviceStorageFileSystem::GetLocalFile(const nsAString& aRealPath) const
bool
DeviceStorageFileSystem::GetRealPath(BlobImpl* aFile, nsAString& aRealPath) const
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Should be on parent process!");
MOZ_ASSERT(aFile, "aFile Should not be null.");
@ -141,7 +141,7 @@ DeviceStorageFileSystem::GetRootName() const
bool
DeviceStorageFileSystem::IsSafeFile(nsIFile* aFile) const
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Should be on parent process!");
MOZ_ASSERT(aFile);

View File

@ -35,7 +35,7 @@ FileSystemTaskBase::FileSystemTaskBase(FileSystemBase* aFileSystem,
, mFileSystem(aFileSystem)
, mRequestParent(aParent)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem, "aFileSystem should not be null.");
@ -61,7 +61,7 @@ FileSystemTaskBase::Start()
return;
}
if (FileSystemUtils::IsParentProcess()) {
if (XRE_IsParentProcess()) {
// Run in parent process.
// Start worker thread.
nsCOMPtr<nsIEventTarget> target
@ -121,7 +121,7 @@ FileSystemTaskBase::HandleResult()
FileSystemResponseValue
FileSystemTaskBase::GetRequestResult() const
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
if (HasError()) {
@ -134,7 +134,7 @@ FileSystemTaskBase::GetRequestResult() const
void
FileSystemTaskBase::SetRequestResult(const FileSystemResponseValue& aValue)
{
MOZ_ASSERT(!FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(!XRE_IsParentProcess(),
"Only call from child process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
if (aValue.type() == FileSystemResponseValue::TFileSystemErrorResponse) {
@ -156,7 +156,7 @@ FileSystemTaskBase::Recv__delete__(const FileSystemResponseValue& aValue)
BlobParent*
FileSystemTaskBase::GetBlobParent(BlobImpl* aFile) const
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFile);

View File

@ -65,12 +65,5 @@ FileSystemUtils::IsDescendantPath(const nsAString& aPath,
return true;
}
// static
bool
FileSystemUtils::IsParentProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Default;
}
} // namespace dom
} // namespace mozilla

View File

@ -41,9 +41,6 @@ public:
static bool
IsDescendantPath(const nsAString& aPath, const nsAString& aDescendantPath);
static bool
IsParentProcess();
static const char16_t kSeparatorChar = char16_t('/');
};

View File

@ -47,7 +47,7 @@ GetFileOrDirectoryTask::GetFileOrDirectoryTask(
: FileSystemTaskBase(aFileSystem, aParam, aParent)
, mIsDirectory(false)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem);
@ -119,7 +119,7 @@ GetFileOrDirectoryTask::SetSuccessRequestResult(const FileSystemResponseValue& a
nsresult
GetFileOrDirectoryTask::Work()
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");

View File

@ -49,7 +49,7 @@ RemoveTask::RemoveTask(FileSystemBase* aFileSystem,
, mRecursive(false)
, mReturnValue(false)
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(aFileSystem);
@ -123,7 +123,7 @@ RemoveTask::SetSuccessRequestResult(const FileSystemResponseValue& aValue)
nsresult
RemoveTask::Work()
{
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
MOZ_ASSERT(XRE_IsParentProcess(),
"Only call from parent process!");
MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");

View File

@ -42,7 +42,7 @@ BEGIN_FMRADIO_NAMESPACE
IFMRadioService*
IFMRadioService::Singleton()
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return FMRadioChild::Singleton();
} else {
return FMRadioService::Singleton();
@ -1243,7 +1243,7 @@ FMRadioService::UpdateFrequency()
FMRadioService*
FMRadioService::Singleton()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
if (!sFMRadioService) {

View File

@ -338,7 +338,7 @@ FMRadioChild::EnableAudio(bool aAudioEnabled)
FMRadioChild*
FMRadioChild::Singleton()
{
MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Default);
MOZ_ASSERT(!XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
if (!sFMRadioChild) {

View File

@ -24,7 +24,7 @@ void
NotifyGamepadChange(const T& aInfo)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
GamepadChangeEvent e(aInfo);
nsTArray<ContentParent*> t;
ContentParent::GetAll(t);
@ -44,7 +44,7 @@ AddGamepad(const char* aID,
uint32_t aNumButtons, uint32_t aNumAxes)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
int index = gGamepadIndex;
gGamepadIndex++;
@ -59,7 +59,7 @@ void
RemoveGamepad(uint32_t aIndex)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
GamepadRemoved a(aIndex);
NotifyGamepadChange<GamepadRemoved>(a);
}
@ -69,7 +69,7 @@ NewButtonEvent(uint32_t aIndex, uint32_t aButton,
bool aPressed, double aValue)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
GamepadButtonInformation a(aIndex, aButton, aPressed, aValue);
NotifyGamepadChange<GamepadButtonInformation>(a);
}
@ -79,7 +79,7 @@ NewButtonEvent(uint32_t aIndex, uint32_t aButton,
bool aPressed)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
// When only a digital button is available the value will be synthesized.
NewButtonEvent(aIndex, aButton, aPressed, aPressed ? 1.0L : 0.0L);
}
@ -89,7 +89,7 @@ NewAxisMoveEvent(uint32_t aIndex, uint32_t aAxis,
double aValue)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
GamepadAxisInformation a(aIndex, aAxis, aValue);
NotifyGamepadChange<GamepadAxisInformation>(a);
}
@ -98,7 +98,7 @@ void
ResetGamepadIndexes()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
gGamepadIndex = 0;
}

View File

@ -17,7 +17,7 @@ void
MaybeStopGamepadMonitoring()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
nsTArray<ContentParent*> t;
ContentParent::GetAll(t);
for(uint32_t i = 0; i < t.Length(); ++i) {

View File

@ -85,7 +85,7 @@ GamepadService::BeginShutdown()
mTimer->Cancel();
}
if (mStarted) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
MaybeStopGamepadMonitoring();
} else {
ContentChild::GetSingleton()->SendGamepadListenerRemoved();
@ -115,7 +115,7 @@ GamepadService::AddListener(nsGlobalWindow* aWindow)
}
if (!mStarted && mEnabled) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
StartGamepadMonitoring();
} else {
ContentChild::GetSingleton()->SendGamepadListenerAdded();
@ -500,7 +500,7 @@ GamepadService::TimeoutHandler(nsITimer* aTimer, void* aClosure)
}
if (self->mListeners.Length() == 0) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
MaybeStopGamepadMonitoring();
} else {
ContentChild::GetSingleton()->SendGamepadListenerRemoved();

View File

@ -564,7 +564,7 @@ already_AddRefed<nsIDOMGeoPosition>
nsGeolocationRequest::AdjustedLocation(nsIDOMGeoPosition *aPosition)
{
nsCOMPtr<nsIDOMGeoPosition> pos = aPosition;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
GPSLOG("child process just copying position");
return pos.forget();
}
@ -758,7 +758,7 @@ nsresult nsGeolocationService::Init()
return NS_ERROR_FAILURE;
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
sGeoInitPending = false;
return NS_OK;
}
@ -1013,7 +1013,7 @@ nsGeolocationService::StartDevice(nsIPrincipal *aPrincipal)
// inactivivity
SetDisconnectTimer();
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
ContentChild* cpc = ContentChild::GetSingleton();
cpc->SendAddGeolocationListener(IPC::Principal(aPrincipal),
HighAccuracyRequested());
@ -1076,7 +1076,7 @@ nsGeolocationService::UpdateAccuracy(bool aForceHigh)
{
bool highRequired = aForceHigh || HighAccuracyRequested();
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
ContentChild* cpc = ContentChild::GetSingleton();
if (cpc->IsAlive()) {
cpc->SendSetGeolocationHigherAccuracy(highRequired);
@ -1103,7 +1103,7 @@ nsGeolocationService::StopDevice()
mDisconnectTimer = nullptr;
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
ContentChild* cpc = ContentChild::GetSingleton();
cpc->SendRemoveGeolocationListener();
return; // bail early

View File

@ -49,7 +49,7 @@ already_AddRefed<nsGeolocationSettings>
nsGeolocationSettings::GetGeolocationSettings()
{
// this singleton is only needed in the parent process...
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
return nullptr;
}

View File

@ -746,7 +746,7 @@ UploadLastDir::FetchDirectoryAndDisplayPicker(nsIDocument* aDoc,
new UploadLastDir::ContentPrefCallback(aFilePicker, aFpCallback);
#ifdef MOZ_B2G
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
prefCallback->HandleCompletion(nsIContentPrefCallback2::COMPLETE_ERROR);
return NS_OK;
}
@ -777,7 +777,7 @@ UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir)
}
#ifdef MOZ_B2G
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
return NS_OK;
}
#endif
@ -2105,7 +2105,7 @@ HTMLInputElement::MozSetFileArray(const Sequence<OwningNonNull<File>>& aFiles)
void
HTMLInputElement::MozSetFileNameArray(const Sequence< nsString >& aFileNames, ErrorResult& aRv)
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return;
}

View File

@ -596,7 +596,7 @@ nsGenericHTMLFrameElement::GetAppManifestURL(nsAString& aOut)
// Only allow content process to embed an app when nested content
// process is enabled.
if (XRE_GetProcessType() != GeckoProcessType_Default &&
if (!XRE_IsParentProcess() &&
!(GetBoolAttr(nsGkAtoms::Remote) && NestedEnabled())){
NS_WARNING("Can't embed-apps. Embed-apps is restricted to in-proc apps "
"or content processes with nested pref enabled, see bug 1097479");

View File

@ -143,7 +143,7 @@ NS_CreateIccService()
{
nsCOMPtr<nsIIccService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
service = new mozilla::dom::icc::IccIPCService();
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
} else {

View File

@ -818,7 +818,7 @@ public:
: PermissionRequestBase(aElement, aPrincipal)
, mChallenge(aChallenge)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aChallenge);
}
@ -844,7 +844,7 @@ public:
WorkerPermissionChallenge* aChallenge)
: mChallenge(aChallenge)
{
MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Default);
MOZ_ASSERT(!XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aChallenge);
}
@ -950,7 +950,7 @@ private:
return true;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<Element> ownerElement =
do_QueryInterface(window->GetChromeEventHandler());
if (NS_WARN_IF(!ownerElement)) {
@ -1399,7 +1399,7 @@ BackgroundFactoryRequestChild::RecvPermissionChallenge(
return false;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsPIDOMWindow> window = mFactory->GetParentObject();
MOZ_ASSERT(window);

View File

@ -82,7 +82,7 @@ BlobImplSnapshot::~BlobImplSnapshot()
void
BlobImplSnapshot::AssertSanity()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
}

View File

@ -252,7 +252,7 @@ IndexedDatabaseManager::GetOrCreate()
}
if (!gDBManager) {
sIsMainProcess = XRE_GetProcessType() == GeckoProcessType_Default;
sIsMainProcess = XRE_IsParentProcess();
if (!sLoggingModule) {
sLoggingModule = PR_NewLogModule("IndexedDB");
@ -598,7 +598,7 @@ IndexedDatabaseManager::IsMainProcess()
{
NS_ASSERTION(gDBManager,
"IsMainProcess() called before indexedDB has been initialized!");
NS_ASSERTION((XRE_GetProcessType() == GeckoProcessType_Default) ==
NS_ASSERTION((XRE_IsParentProcess()) ==
sIsMainProcess, "XRE_GetProcessType changed its tune!");
return sIsMainProcess;
}

View File

@ -43,7 +43,7 @@ const uint32_t kPermissionDefault = nsIPermissionManager::UNKNOWN_ACTION;
void
AssertSanity()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
}

View File

@ -3250,7 +3250,7 @@ BlobChild::AssertIsOnOwningThread() const
void
BlobChild::Startup(const FriendKey& /* aKey */)
{
MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Default);
MOZ_ASSERT(!XRE_IsParentProcess());
CommonStartup();
}
@ -3773,7 +3773,7 @@ BlobParent::AssertIsOnOwningThread() const
void
BlobParent::Startup(const FriendKey& /* aKey */)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
CommonStartup();

View File

@ -2831,7 +2831,7 @@ uint64_t
NextWindowID()
{
uint64_t processID = 0;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
ContentChild* cc = ContentChild::GetSingleton();
processID = cc->GetID();
}

View File

@ -779,7 +779,7 @@ ContentParent::StartUp()
// child process
sCanLaunchSubprocesses = true;
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return;
}
@ -1153,7 +1153,7 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
}
ProcessPriority initialPriority = GetInitialProcessPriority(aFrameElement);
bool isInContentProcess = (XRE_GetProcessType() != GeckoProcessType_Default);
bool isInContentProcess = !XRE_IsParentProcess();
TabId tabId;
nsIDocShell* docShell = GetOpenerDocShellHelper(aFrameElement);
@ -1812,7 +1812,7 @@ ContentParent::OnChannelError()
void
ContentParent::OnBeginSyncTransaction() {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
JSContext *cx = nsContentUtils::GetCurrentJSContext();
if (!sDisableUnsafeCPOWWarnings) {
@ -4876,7 +4876,7 @@ ContentParent::AllocateTabId(const TabId& aOpenerTabId,
const ContentParentId& aCpId)
{
TabId tabId;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
ContentProcessManager *cpm = ContentProcessManager::GetSingleton();
tabId = cpm->AllocateTabId(aOpenerTabId, aContext, aCpId);
}
@ -4893,7 +4893,7 @@ ContentParent::AllocateTabId(const TabId& aOpenerTabId,
ContentParent::DeallocateTabId(const TabId& aTabId,
const ContentParentId& aCpId)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
ContentProcessManager::GetSingleton()->DeallocateTabId(aCpId,
aTabId);
}
@ -5092,7 +5092,7 @@ ContentParent::DeallocPContentPermissionRequestParent(PContentPermissionRequestP
bool
ContentParent::RecvGetBrowserConfiguration(const nsCString& aURI, BrowserConfiguration* aConfig)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
return GetBrowserConfiguration(aURI, *aConfig);;
}
@ -5100,7 +5100,7 @@ ContentParent::RecvGetBrowserConfiguration(const nsCString& aURI, BrowserConfigu
/*static*/ bool
ContentParent::GetBrowserConfiguration(const nsCString& aURI, BrowserConfiguration& aConfig)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsRefPtr<ServiceWorkerRegistrar> swr = ServiceWorkerRegistrar::Get();
MOZ_ASSERT(swr);

View File

@ -32,7 +32,7 @@ ContentProcessManager::sSingleton;
/* static */ ContentProcessManager*
ContentProcessManager::GetSingleton()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
if (!sSingleton) {
sSingleton = new ContentProcessManager();

View File

@ -887,7 +887,7 @@ ProcessHangMonitor::ProcessHangMonitor()
MOZ_COUNT_CTOR(ProcessHangMonitor);
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
obs->AddObserver(this, "xpcom-shutdown", false);
}

View File

@ -384,7 +384,7 @@ ProcessPriorityManagerImpl::StaticInit()
}
// The process priority manager is main-process only.
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
sInitialized = true;
return;
}
@ -427,7 +427,7 @@ ProcessPriorityManagerImpl::ProcessPriorityManagerImpl()
, mBackgroundLRUPool(PROCESS_PRIORITY_BACKGROUND)
, mBackgroundPerceivableLRUPool(PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
RegisterWakeLockObserver(this);
}
@ -660,7 +660,7 @@ ParticularProcessPriorityManager::ParticularProcessPriorityManager(
, mIsActivityOpener(false)
, mFrozen(aFrozen)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
LOGP("Creating ParticularProcessPriorityManager.");
}
@ -826,7 +826,7 @@ ParticularProcessPriorityManager::OnRemoteBrowserFrameShown(nsISupports* aSubjec
TabParent* tp = TabParent::GetFrom(fl);
NS_ENSURE_TRUE_VOID(tp);
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
if (tp->Manager() != mContentParent) {
return;
}
@ -850,7 +850,7 @@ ParticularProcessPriorityManager::OnTabParentDestroyed(nsISupports* aSubject)
nsCOMPtr<nsITabParent> tp = do_QueryInterface(aSubject);
NS_ENSURE_TRUE_VOID(tp);
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
if (TabParent::GetFrom(tp)->Manager() != mContentParent) {
return;
}
@ -873,7 +873,7 @@ ParticularProcessPriorityManager::OnFrameloaderVisibleChanged(nsISupports* aSubj
return;
}
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
if (tp->Manager() != mContentParent) {
return;
}
@ -1213,7 +1213,7 @@ NS_IMPL_ISUPPORTS(ProcessPriorityManagerChild,
ProcessPriorityManagerChild::ProcessPriorityManagerChild()
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
mCachedPriority = PROCESS_PRIORITY_MASTER;
} else {
mCachedPriority = PROCESS_PRIORITY_UNKNOWN;
@ -1225,7 +1225,7 @@ ProcessPriorityManagerChild::Init()
{
// The process priority should only be changed in child processes; don't even
// bother listening for changes if we're in the main process.
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
NS_ENSURE_TRUE_VOID(os);
os->AddObserver(this, "ipc:process-priority-changed", /* weak = */ false);

View File

@ -447,7 +447,7 @@ TabParent::Destroy()
}
mIsDestroyed = true;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
Manager()->AsContentParent()->NotifyTabDestroying(this);
}
@ -465,7 +465,7 @@ TabParent::Destroy()
bool
TabParent::Recv__delete__()
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
Manager()->AsContentParent()->NotifyTabDestroyed(this, mMarkedDestroying);
ContentParent::DeallocateTabId(mTabId,
Manager()->AsContentParent()->ChildID());

View File

@ -1449,7 +1449,7 @@ MediaManager::NotifyRecordingStatusChange(nsPIDOMWindow* aWindow,
// Forward recording events to parent process.
// The events are gathered in chrome process and used for recording indicator
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
unused <<
dom::ContentChild::GetSingleton()->SendRecordingDeviceEvents(aMsg,
requestURL,

View File

@ -109,7 +109,7 @@ private:
MOZ_ASSERT(NS_IsMainThread());
if (!sSingletonService) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsRefPtr<GeckoMediaPluginServiceParent> service =
new GeckoMediaPluginServiceParent();
service->Init();

View File

@ -33,7 +33,7 @@ namespace gmp {
already_AddRefed<GeckoMediaPluginServiceChild>
GeckoMediaPluginServiceChild::GetSingleton()
{
MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Default);
MOZ_ASSERT(!XRE_IsParentProcess());
nsRefPtr<GeckoMediaPluginService> service(
GeckoMediaPluginService::GetGeckoMediaPluginService());
#ifdef DEBUG

View File

@ -60,7 +60,7 @@ static const uint32_t NodeIdSaltLength = 32;
already_AddRefed<GeckoMediaPluginServiceParent>
GeckoMediaPluginServiceParent::GetSingleton()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
nsRefPtr<GeckoMediaPluginService> service(
GeckoMediaPluginServiceParent::GetGeckoMediaPluginService());
#ifdef DEBUG
@ -144,7 +144,7 @@ GeckoMediaPluginServiceParent::InitStorage()
MOZ_ASSERT(NS_IsMainThread());
// GMP storage should be used in the chrome process only.
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return NS_OK;
}

View File

@ -146,7 +146,7 @@ NS_IMETHODIMP
nsSpeechTask::Setup(nsISpeechTaskCallback* aCallback,
uint32_t aChannels, uint32_t aRate, uint8_t argc)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
LOG(LogLevel::Debug, ("nsSpeechTask::Setup"));
@ -195,7 +195,7 @@ NS_IMETHODIMP
nsSpeechTask::SendAudio(JS::Handle<JS::Value> aData, JS::Handle<JS::Value> aLandmarks,
JSContext* aCx)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
NS_ENSURE_TRUE(mStream, NS_ERROR_NOT_AVAILABLE);
NS_ENSURE_FALSE(mStream->IsDestroyed(), NS_ERROR_NOT_AVAILABLE);
@ -237,7 +237,7 @@ nsSpeechTask::SendAudio(JS::Handle<JS::Value> aData, JS::Handle<JS::Value> aLand
NS_IMETHODIMP
nsSpeechTask::SendAudioNative(int16_t* aData, uint32_t aDataLen)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
NS_ENSURE_TRUE(mStream, NS_ERROR_NOT_AVAILABLE);
NS_ENSURE_FALSE(mStream->IsDestroyed(), NS_ERROR_NOT_AVAILABLE);
@ -481,7 +481,7 @@ nsSpeechTask::DispatchMarkImpl(const nsAString& aName,
void
nsSpeechTask::Pause()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
if (mCallback) {
DebugOnly<nsresult> rv = mCallback->OnPause();
@ -497,7 +497,7 @@ nsSpeechTask::Pause()
void
nsSpeechTask::Resume()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
if (mCallback) {
DebugOnly<nsresult> rv = mCallback->OnResume();
@ -513,7 +513,7 @@ nsSpeechTask::Resume()
void
nsSpeechTask::Cancel()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
LOG(LogLevel::Debug, ("nsSpeechTask::Cancel"));

View File

@ -100,7 +100,7 @@ NS_IMPL_ISUPPORTS(nsSynthVoiceRegistry, nsISynthVoiceRegistry)
nsSynthVoiceRegistry::nsSynthVoiceRegistry()
: mSpeechSynthChild(nullptr)
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
mSpeechSynthChild = new SpeechSynthesisChild();
ContentChild::GetSingleton()->SendPSpeechSynthesisConstructor(mSpeechSynthChild);
@ -165,7 +165,7 @@ void
nsSynthVoiceRegistry::Shutdown()
{
LOG(LogLevel::Debug, ("[%s] nsSynthVoiceRegistry::Shutdown()",
(XRE_GetProcessType() == GeckoProcessType_Content) ? "Content" : "Default"));
(XRE_IsContentProcess()) ? "Content" : "Default"));
gSynthVoiceRegistry = nullptr;
}
@ -236,7 +236,7 @@ nsSynthVoiceRegistry::AddVoice(nsISpeechService* aService,
NS_ConvertUTF16toUTF8(aLang).get(),
aLocalService ? "true" : "false"));
NS_ENSURE_FALSE(XRE_GetProcessType() == GeckoProcessType_Content,
NS_ENSURE_FALSE(XRE_IsContentProcess(),
NS_ERROR_NOT_AVAILABLE);
return AddVoiceImpl(aService, aUri, aName, aLang,
@ -250,7 +250,7 @@ nsSynthVoiceRegistry::RemoveVoice(nsISpeechService* aService,
LOG(LogLevel::Debug,
("nsSynthVoiceRegistry::RemoveVoice uri='%s' (%s)",
NS_ConvertUTF16toUTF8(aUri).get(),
(XRE_GetProcessType() == GeckoProcessType_Content) ? "child" : "parent"));
(XRE_IsContentProcess()) ? "child" : "parent"));
bool found = false;
VoiceData* retval = mUriVoiceMap.GetWeak(aUri, &found);
@ -289,7 +289,7 @@ nsSynthVoiceRegistry::SetDefaultVoice(const nsAString& aUri,
mDefaultVoices.AppendElement(retval);
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsTArray<SpeechSynthesisParent*> ssplist;
GetAllSpeechSynthActors(ssplist);
@ -521,7 +521,7 @@ nsSynthVoiceRegistry::SpeakUtterance(SpeechSynthesisUtterance& aUtterance,
}
nsRefPtr<nsSpeechTask> task;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
task = new SpeechTaskChild(&aUtterance);
SpeechSynthesisRequestChild* actor =
new SpeechSynthesisRequestChild(static_cast<SpeechTaskChild*>(task.get()));

View File

@ -723,7 +723,7 @@ nsPicoService*
nsPicoService::GetInstance()
{
MOZ_ASSERT(NS_IsMainThread());
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
MOZ_ASSERT(false, "nsPicoService can only be started on main gecko process");
return nullptr;
}

View File

@ -326,7 +326,7 @@ nsFakeSynthServices*
nsFakeSynthServices::GetInstance()
{
MOZ_ASSERT(NS_IsMainThread());
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
MOZ_ASSERT(false, "nsFakeSynthServices can only be started on main gecko process");
return nullptr;
}

View File

@ -101,7 +101,7 @@ NS_CreateMobileConnectionService()
{
nsCOMPtr<nsIMobileConnectionService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
service = new mozilla::dom::mobileconnection::MobileConnectionIPCService();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)

View File

@ -845,7 +845,7 @@ NS_CreateSmsService()
{
nsCOMPtr<nsISmsService> smsService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
smsService = SmsIPCService::GetSingleton();
} else {
#ifdef MOZ_WIDGET_ANDROID
@ -862,7 +862,7 @@ already_AddRefed<nsIMobileMessageDatabaseService>
NS_CreateMobileMessageDatabaseService()
{
nsCOMPtr<nsIMobileMessageDatabaseService> mobileMessageDBService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
mobileMessageDBService = SmsIPCService::GetSingleton();
} else {
#ifdef MOZ_WIDGET_ANDROID
@ -881,7 +881,7 @@ NS_CreateMmsService()
{
nsCOMPtr<nsIMmsService> mmsService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
mmsService = SmsIPCService::GetSingleton();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)

View File

@ -558,7 +558,7 @@ UDPSocket::Init(const nsString& aLocalAddress,
}
nsresult rv;
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
rv = mSocket->InitRemote(mSocket->mLocalAddress, localPort);
} else {
rv = mSocket->InitLocal(mSocket->mLocalAddress, localPort);

View File

@ -312,7 +312,7 @@ NfcService::~NfcService()
already_AddRefed<NfcService>
NfcService::FactoryCreate()
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return nullptr;
}

View File

@ -249,7 +249,7 @@ nsNPAPIPlugin::PluginCrashed(const nsAString& pluginDumpID,
bool
nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag)
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
return true;
}
@ -404,7 +404,7 @@ GetNewPluginLibrary(nsPluginTag *aPluginTag)
return nullptr;
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
return PluginModuleContentParent::LoadModule(aPluginTag->mId);
}

View File

@ -253,7 +253,7 @@ nsPluginHost::nsPluginHost()
// good plugin list the first time it requests it. Normally we'd just
// init this to 1, but due to the unique nature of our ctor we need to do
// this manually.
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
IncrementChromeEpoch();
}
@ -1271,7 +1271,7 @@ nsresult nsPluginHost::EnsurePluginLoaded(nsPluginTag* aPluginTag)
nsresult
nsPluginHost::GetPluginForContentProcess(uint32_t aPluginId, nsNPAPIPlugin** aPlugin)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
// If plugins haven't been scanned yet, do so now
LoadPlugins();
@ -1336,7 +1336,7 @@ protected:
void
nsPluginHost::NotifyContentModuleDestroyed(uint32_t aPluginId)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
// This is called in response to a message from the plugin. Don't unload the
// plugin until the message handler is off the stack.
@ -1842,7 +1842,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
bool aCreatePluginList,
bool *aPluginsChanged)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
NS_ENSURE_ARG_POINTER(aPluginsChanged);
nsresult rv;
@ -2049,7 +2049,7 @@ nsresult nsPluginHost::ScanPluginsDirectoryList(nsISimpleEnumerator *dirEnum,
bool aCreatePluginList,
bool *aPluginsChanged)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
bool hasMore;
while (NS_SUCCEEDED(dirEnum->HasMoreElements(&hasMore)) && hasMore) {
@ -2078,28 +2078,28 @@ nsresult nsPluginHost::ScanPluginsDirectoryList(nsISimpleEnumerator *dirEnum,
void
nsPluginHost::IncrementChromeEpoch()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
mPluginEpoch++;
}
uint32_t
nsPluginHost::ChromeEpoch()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
return mPluginEpoch;
}
uint32_t
nsPluginHost::ChromeEpochForContent()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content);
MOZ_ASSERT(XRE_IsContentProcess());
return mPluginEpoch;
}
void
nsPluginHost::SetChromeEpochForContent(uint32_t aEpoch)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content);
MOZ_ASSERT(XRE_IsContentProcess());
mPluginEpoch = aEpoch;
}
@ -2129,7 +2129,7 @@ WatchRegKey(uint32_t aRoot, nsCOMPtr<nsIWindowsRegKey>& aKey)
nsresult nsPluginHost::LoadPlugins()
{
#ifdef ANDROID
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
return NS_OK;
}
#endif
@ -2153,7 +2153,7 @@ nsresult nsPluginHost::LoadPlugins()
// only if plugins have changed will we notify plugin-change observers
if (pluginschanged) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
IncrementChromeEpoch();
}
@ -2169,7 +2169,7 @@ nsresult nsPluginHost::LoadPlugins()
nsresult
nsPluginHost::FindPluginsInContent(bool aCreatePluginList, bool* aPluginsChanged)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content);
MOZ_ASSERT(XRE_IsContentProcess());
dom::ContentChild* cp = dom::ContentChild::GetSingleton();
nsTArray<PluginTag> plugins;
@ -2225,7 +2225,7 @@ nsresult nsPluginHost::FindPlugins(bool aCreatePluginList, bool * aPluginsChange
*aPluginsChanged = false;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
return FindPluginsInContent(aCreatePluginList, aPluginsChanged);
}
@ -2392,7 +2392,7 @@ mozilla::plugins::FindPluginsForContent(uint32_t aPluginEpoch,
nsTArray<PluginTag>* aPlugins,
uint32_t* aNewPluginEpoch)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
nsRefPtr<nsPluginHost> host = nsPluginHost::GetInst();
host->FindPluginsForContent(aPluginEpoch, aPlugins, aNewPluginEpoch);
@ -2404,7 +2404,7 @@ nsPluginHost::FindPluginsForContent(uint32_t aPluginEpoch,
nsTArray<PluginTag>* aPlugins,
uint32_t* aNewPluginEpoch)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
// Load plugins so that the epoch is correct.
LoadPlugins();
@ -2444,7 +2444,7 @@ nsPluginHost::FindPluginsForContent(uint32_t aPluginEpoch,
void
nsPluginHost::UpdatePluginInfo(nsPluginTag* aPluginTag)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
ReadPluginInfo();
WritePluginInfo();
@ -2530,7 +2530,7 @@ nsPluginHost::RegisterWithCategoryManager(nsCString &aMimeType,
nsresult
nsPluginHost::WritePluginInfo()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
nsresult rv = NS_OK;
nsCOMPtr<nsIProperties> directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID,&rv));
@ -2675,7 +2675,7 @@ nsPluginHost::WritePluginInfo()
nsresult
nsPluginHost::ReadPluginInfo()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
const long PLUGIN_REG_MIMETYPES_ARRAY_SIZE = 12;
const long PLUGIN_REG_MAX_MIMETYPES = 1000;

View File

@ -652,7 +652,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
// we only attempt to get the nearest window if this really is a "windowless" plugin so as not
// to change any behaviour for the much more common windowed plugins,
// though why this method would even be being called for a windowed plugin escapes me.
if (XRE_GetProcessType() != GeckoProcessType_Content &&
if (!XRE_IsContentProcess() &&
mPluginWindow && mPluginWindow->type == NPWindowTypeDrawable) {
// it turns out that flash also uses this window for determining focus, and is currently
// unable to show a caret correctly if we return the enclosing window. Therefore for
@ -2840,7 +2840,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
parentWidget = nsContentUtils::WidgetForDocument(doc);
#ifndef XP_MACOSX
// If we're running in the content process, we need a remote widget created in chrome.
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
nsCOMPtr<nsIDOMWindow> window = doc->GetWindow();
if (window) {
nsCOMPtr<nsIDOMWindow> topWindow;
@ -2962,7 +2962,7 @@ void nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState)
mPluginWindow->clipRect.bottom = mPluginWindow->clipRect.top;
mPluginWindow->clipRect.right = mPluginWindow->clipRect.left;
}
else if (XRE_GetProcessType() != GeckoProcessType_Default)
else if (!XRE_IsParentProcess())
{
// For e10s we only support async windowless plugin. This means that
// we're always going to allocate a full window for the plugin to draw
@ -3156,7 +3156,7 @@ nsPluginInstanceOwner::UpdateDocumentActiveState(bool aIsActive)
// to be forwarded over after the active state is updated. If we
// don't hide plugin widgets in hidden tabs, the native child window
// in chrome will remain visible after a tab switch.
if (mWidget && XRE_GetProcessType() == GeckoProcessType_Content) {
if (mWidget && XRE_IsContentProcess()) {
mWidget->Show(aIsActive);
mWidget->Enable(aIsActive);
}

View File

@ -72,7 +72,7 @@ nsresult nsPluginNativeWindowGtk::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance>
{
if (aPluginInstance) {
if (type == NPWindowTypeWindow &&
XRE_GetProcessType() == GeckoProcessType_Content) {
XRE_IsContentProcess()) {
// In this case, most of the initialization code here has already happened
// in the chrome process. The window we have in content is the XID of the
// socket widget we need to hand to plugins.

View File

@ -617,7 +617,7 @@ nsresult nsPluginNativeWindowWin::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance>
// With e10s we execute in the content process and as such we don't
// have access to native widgets. CallSetWindow and skip native widget
// subclassing.
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
nsPluginNativeWindow::CallSetWindow(aPluginInstance);
return NS_OK;
}

View File

@ -651,7 +651,7 @@ nsPluginTag::GetBlocklistState(uint32_t *aResult)
return NS_OK;
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
*aResult = nsIBlocklistService::STATE_BLOCKED;
dom::ContentChild* cp = dom::ContentChild::GetSingleton();
if (!cp->SendGetBlocklistState(mId, aResult)) {

View File

@ -1856,7 +1856,7 @@ PluginInstanceParent::SubclassPluginWindow(HWND aWnd)
return;
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
if (!aWnd) {
NS_WARNING("PluginInstanceParent::SubclassPluginWindow unexpected null window");
return;
@ -1886,7 +1886,7 @@ PluginInstanceParent::SubclassPluginWindow(HWND aWnd)
void
PluginInstanceParent::UnsubclassPluginWindow()
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
if (mPluginHWND) {
// Remove 'this' from the plugin list safely
nsAutoPtr<PluginInstanceParent> tmp;

View File

@ -352,7 +352,7 @@ bool PluginModuleMapping::sIsLoadModuleOnStack = false;
void
mozilla::plugins::TerminatePlugin(uint32_t aPluginId, const nsString& aBrowserDumpId)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
nsRefPtr<nsPluginHost> host = nsPluginHost::GetInst();
nsPluginTag* pluginTag = host->PluginWithId(aPluginId);
@ -370,7 +370,7 @@ PluginModuleContentParent::LoadModule(uint32_t aPluginId)
PluginModuleMapping::NotifyLoadingModule loadingModule;
nsAutoPtr<PluginModuleMapping> mapping(new PluginModuleMapping(aPluginId));
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content);
MOZ_ASSERT(XRE_IsContentProcess());
/*
* We send a LoadPlugin message to the chrome process using an intr

View File

@ -96,7 +96,7 @@ PromiseDebugging::Init()
// Generate a prefix for identifiers: "PromiseDebugging.$processid."
sIDPrefix = NS_LITERAL_STRING("PromiseDebugging.");
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
sIDPrefix.AppendInt(ContentChild::GetSingleton()->GetID());
sIDPrefix.Append('.');
} else {

View File

@ -756,11 +756,6 @@ struct MOZ_STACK_CLASS InactiveOriginsInfo
nsTArray<OriginInfo*>& origins;
};
bool
IsMainProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Default;
}
void
SanitizeOriginString(nsCString& aOrigin)
@ -1370,7 +1365,7 @@ nsresult
QuotaManager::Init()
{
nsresult rv;
if (IsMainProcess()) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIFile> baseDir;
rv = NS_GetSpecialDirectory(NS_APP_INDEXEDDB_PARENT_DIR,
getter_AddRefs(baseDir));
@ -2791,7 +2786,7 @@ QuotaManager::GetUsageForURI(nsIURI* aURI,
NS_ENSURE_ARG_POINTER(aCallback);
// This only works from the main process.
NS_ENSURE_TRUE(IsMainProcess(), NS_ERROR_NOT_AVAILABLE);
NS_ENSURE_TRUE(XRE_IsParentProcess(), NS_ERROR_NOT_AVAILABLE);
if (!aOptionalArgCount) {
aAppId = nsIScriptSecurityManager::NO_APP_ID;
@ -2879,7 +2874,7 @@ QuotaManager::ClearStoragesForURI(nsIURI* aURI,
}
// This only works from the main process.
NS_ENSURE_TRUE(IsMainProcess(), NS_ERROR_NOT_AVAILABLE);
NS_ENSURE_TRUE(XRE_IsParentProcess(), NS_ERROR_NOT_AVAILABLE);
if (!aOptionalArgCount) {
aAppId = nsIScriptSecurityManager::NO_APP_ID;
@ -2982,7 +2977,7 @@ QuotaManager::Observe(nsISupports* aSubject,
NS_ERROR("Shutdown more than once?!");
}
if (IsMainProcess()) {
if (XRE_IsParentProcess()) {
// Kick off the shutdown timer.
if (NS_FAILED(mShutdownTimer->Init(this, DEFAULT_SHUTDOWN_TIMER_MS,
nsITimer::TYPE_ONE_SHOT))) {
@ -3021,7 +3016,7 @@ QuotaManager::Observe(nsISupports* aSubject,
}
if (!strcmp(aTopic, NS_TIMER_CALLBACK_TOPIC)) {
NS_ASSERTION(IsMainProcess(), "Should only happen in the main process!");
NS_ASSERTION(XRE_IsParentProcess(), "Should only happen in the main process!");
NS_WARNING("Some storage operations are taking longer than expected "
"during shutdown and will be aborted!");
@ -3215,7 +3210,7 @@ QuotaManager::ClearStoragesForApp(uint32_t aAppId, bool aBrowserOnly)
NS_ASSERTION(aAppId != kUnknownAppId, "Bad appId!");
// This only works from the main process.
NS_ENSURE_TRUE(IsMainProcess(), NS_ERROR_NOT_AVAILABLE);
NS_ENSURE_TRUE(XRE_IsParentProcess(), NS_ERROR_NOT_AVAILABLE);
nsAutoCString pattern;
GetOriginPatternStringMaybeIgnoreBrowser(aAppId, aBrowserOnly, pattern);

View File

@ -30,7 +30,7 @@ SpeakerManagerService::GetOrCreateSpeakerManagerService()
{
MOZ_ASSERT(NS_IsMainThread());
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return SpeakerManagerServiceChild::GetOrCreateSpeakerManagerService();
}
@ -52,7 +52,7 @@ SpeakerManagerService::GetSpeakerManagerService()
{
MOZ_ASSERT(NS_IsMainThread());
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return SpeakerManagerServiceChild::GetSpeakerManagerService();
}
@ -62,7 +62,7 @@ SpeakerManagerService::GetSpeakerManagerService()
void
SpeakerManagerService::Shutdown()
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return SpeakerManagerServiceChild::Shutdown();
}
@ -188,7 +188,7 @@ SpeakerManagerService::SpeakerManagerService()
mVisible(false)
{
MOZ_COUNT_CTOR(SpeakerManagerService);
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->AddObserver(this, "ipc:content-shutdown", false);

View File

@ -761,7 +761,7 @@ DOMStorageCache::StartDatabase()
return sDatabase;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsAutoPtr<DOMStorageDBThread> db(new DOMStorageDBThread());
nsresult rv = db->Init();
@ -806,7 +806,7 @@ DOMStorageCache::StopDatabase()
sDatabaseDown = true;
nsresult rv = sDatabase->Shutdown();
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
delete sDatabase;
} else {
DOMStorageDBChild* child = static_cast<DOMStorageDBChild*>(sDatabase);

View File

@ -592,7 +592,7 @@ DOMStorageManager::Observe(const char* aTopic, const nsACString& aScopePrefix)
}
if (!strcmp(aTopic, "test-flushed")) {
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(nullptr, "domstorage-test-flushed", nullptr);
@ -615,7 +615,7 @@ DOMLocalStorageManager::DOMLocalStorageManager()
NS_ASSERTION(!sSelf, "Somebody is trying to do_CreateInstance(\"@mozilla/dom/localStorage-manager;1\"");
sSelf = this;
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
// Do this only on the child process. The thread IPC bridge
// is also used to communicate chrome observer notifications.
// Note: must be called after we set sSelf
@ -648,7 +648,7 @@ DOMLocalStorageManager::Ensure()
DOMSessionStorageManager::DOMSessionStorageManager()
: DOMStorageManager(SessionStorage)
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
// Do this only on the child process. The thread IPC bridge
// is also used to communicate chrome observer notifications.
DOMStorageCache::StartDatabase();

View File

@ -75,7 +75,7 @@ DOMStorageObserver::Init()
#ifdef DOM_STORAGE_TESTS
// Testing
obs->AddObserver(sSelf, "domstorage-test-flush-force", true);
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// Only to forward to child process.
obs->AddObserver(sSelf, "domstorage-test-flushed", true);
}

View File

@ -555,7 +555,7 @@ already_AddRefed<AudioManager>
AudioManager::GetInstance()
{
// Avoid createing AudioManager from content process.
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
MOZ_CRASH("Non-chrome processes should not get here.");
}

View File

@ -1298,7 +1298,7 @@ ShutdownAutoMounterIOThread()
static void
SetAutoMounterModeIOThread(const int32_t& aMode)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
MOZ_ASSERT(sAutoMounter);
@ -1308,7 +1308,7 @@ SetAutoMounterModeIOThread(const int32_t& aMode)
static void
SetAutoMounterSharingModeIOThread(const nsCString& aVolumeName, const bool& aAllowSharing)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
MOZ_ASSERT(sAutoMounter);
@ -1318,7 +1318,7 @@ SetAutoMounterSharingModeIOThread(const nsCString& aVolumeName, const bool& aAll
static void
AutoMounterFormatVolumeIOThread(const nsCString& aVolumeName)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
MOZ_ASSERT(sAutoMounter);
@ -1328,7 +1328,7 @@ AutoMounterFormatVolumeIOThread(const nsCString& aVolumeName)
static void
AutoMounterMountVolumeIOThread(const nsCString& aVolumeName)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
MOZ_ASSERT(sAutoMounter);
@ -1338,7 +1338,7 @@ AutoMounterMountVolumeIOThread(const nsCString& aVolumeName)
static void
AutoMounterUnmountVolumeIOThread(const nsCString& aVolumeName)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
MOZ_ASSERT(sAutoMounter);

View File

@ -134,7 +134,7 @@ NetworkWorker::~NetworkWorker()
already_AddRefed<NetworkWorker>
NetworkWorker::FactoryCreate()
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return nullptr;
}

View File

@ -72,7 +72,7 @@ SystemWorkerManager::~SystemWorkerManager()
nsresult
SystemWorkerManager::Init()
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return NS_ERROR_NOT_AVAILABLE;
}

View File

@ -233,7 +233,7 @@ Volume::SetConfig(const nsCString& aConfigName, const nsCString& aConfigValue)
void
Volume::SetMediaPresent(bool aMediaPresent)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
// mMediaPresent is slightly redunant to the state, however
@ -308,7 +308,7 @@ Volume::SetUnmountRequested(bool aUnmountRequested)
void
Volume::SetState(Volume::STATE aNewState)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
if (aNewState == mState) {
return;
@ -380,7 +380,7 @@ Volume::SetState(Volume::STATE aNewState)
void
Volume::SetMountPoint(const nsCSubstring& aMountPoint)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
if (mMountPoint.Equals(aMountPoint)) {
@ -393,7 +393,7 @@ Volume::SetMountPoint(const nsCSubstring& aMountPoint)
void
Volume::StartMount(VolumeResponseCallback* aCallback)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
StartCommand(new VolumeActionCommand(this, "mount", "", aCallback));
@ -402,7 +402,7 @@ Volume::StartMount(VolumeResponseCallback* aCallback)
void
Volume::StartUnmount(VolumeResponseCallback* aCallback)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
StartCommand(new VolumeActionCommand(this, "unmount", "force", aCallback));
@ -411,7 +411,7 @@ Volume::StartUnmount(VolumeResponseCallback* aCallback)
void
Volume::StartFormat(VolumeResponseCallback* aCallback)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
StartCommand(new VolumeActionCommand(this, "format", "", aCallback));
@ -420,7 +420,7 @@ Volume::StartFormat(VolumeResponseCallback* aCallback)
void
Volume::StartShare(VolumeResponseCallback* aCallback)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
StartCommand(new VolumeActionCommand(this, "share", "ums", aCallback));
@ -429,7 +429,7 @@ Volume::StartShare(VolumeResponseCallback* aCallback)
void
Volume::StartUnshare(VolumeResponseCallback* aCallback)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
StartCommand(new VolumeActionCommand(this, "unshare", "ums", aCallback));
@ -438,7 +438,7 @@ Volume::StartUnshare(VolumeResponseCallback* aCallback)
void
Volume::StartCommand(VolumeCommand* aCommand)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
VolumeManager::PostCommand(aCommand);
@ -448,7 +448,7 @@ Volume::StartCommand(VolumeCommand* aCommand)
void
Volume::RegisterVolumeObserver(Volume::EventObserver* aObserver, const char* aName)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
sEventObserverList.AddObserver(aObserver);
@ -468,7 +468,7 @@ Volume::RegisterVolumeObserver(Volume::EventObserver* aObserver, const char* aNa
void
Volume::UnregisterVolumeObserver(Volume::EventObserver* aObserver, const char* aName)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
sEventObserverList.RemoveObserver(aObserver);
@ -483,7 +483,7 @@ Volume::UpdateMountLock(const nsACString& aVolumeName,
const int32_t& aMountGeneration,
const bool& aMountLocked)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
@ -500,7 +500,7 @@ Volume::UpdateMountLock(const nsACString& aVolumeName,
void
Volume::HandleVoldResponse(int aResponseCode, nsCWhitespaceTokenizer& aTokenizer)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
// The volume name will have already been parsed, and the tokenizer will point

View File

@ -246,7 +246,7 @@ NS_IMETHODIMP nsVolume::GetIsHotSwappable(bool *aIsHotSwappable)
NS_IMETHODIMP nsVolume::Format()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
XRE_GetIOMessageLoop()->PostTask(
FROM_HERE,
@ -258,7 +258,7 @@ NS_IMETHODIMP nsVolume::Format()
/* static */
void nsVolume::FormatVolumeIOThread(const nsCString& aVolume)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
if (VolumeManager::State() != VolumeManager::VOLUMES_READY) {
@ -270,7 +270,7 @@ void nsVolume::FormatVolumeIOThread(const nsCString& aVolume)
NS_IMETHODIMP nsVolume::Mount()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
XRE_GetIOMessageLoop()->PostTask(
FROM_HERE,
@ -282,7 +282,7 @@ NS_IMETHODIMP nsVolume::Mount()
/* static */
void nsVolume::MountVolumeIOThread(const nsCString& aVolume)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
if (VolumeManager::State() != VolumeManager::VOLUMES_READY) {
@ -294,7 +294,7 @@ void nsVolume::MountVolumeIOThread(const nsCString& aVolume)
NS_IMETHODIMP nsVolume::Unmount()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
XRE_GetIOMessageLoop()->PostTask(
FROM_HERE,
@ -306,7 +306,7 @@ NS_IMETHODIMP nsVolume::Unmount()
/* static */
void nsVolume::UnmountVolumeIOThread(const nsCString& aVolume)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
if (VolumeManager::State() != VolumeManager::VOLUMES_READY) {
@ -364,7 +364,7 @@ void nsVolume::Set(nsIVolume* aVolume)
mMountGeneration = volMountGeneration;
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
// Child processes just track the state, not maintain it.
aVolume->GetIsMountLocked(&mMountLocked);
return;
@ -386,7 +386,7 @@ void nsVolume::Set(nsIVolume* aVolume)
void
nsVolume::UpdateMountLock(const nsAString& aMountLockState)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
// There are 3 states, unlocked, locked-background, and locked-foreground
@ -397,7 +397,7 @@ nsVolume::UpdateMountLock(const nsAString& aMountLockState)
void
nsVolume::UpdateMountLock(bool aMountLocked)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
if (aMountLocked == mMountLocked) {
@ -447,7 +447,7 @@ nsVolume::SetState(int32_t aState)
{
static int32_t sMountGeneration = 0;
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(IsFake());

View File

@ -68,7 +68,7 @@ nsVolumeService::Shutdown()
if (!sSingleton) {
return;
}
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
sSingleton = nullptr;
return;
}
@ -92,7 +92,7 @@ nsVolumeService::nsVolumeService()
{
sSingleton = this;
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
// VolumeServiceIOThread and the WakeLock listener should only run in the
// parent, so we return early.
return;
@ -271,7 +271,7 @@ nsVolumeService::GetVolumeNames(nsIArray** aVolNames)
void
nsVolumeService::GetVolumesForIPC(nsTArray<VolumeInfo>* aResult)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
MonitorAutoLock autoLock(mArrayMonitor);
@ -299,7 +299,7 @@ nsVolumeService::GetVolumesForIPC(nsTArray<VolumeInfo>* aResult)
void
nsVolumeService::RecvVolumesFromParent(const nsTArray<VolumeInfo>& aVolumes)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
// We are the parent. Therefore our volumes are already correct.
return;
}
@ -340,7 +340,7 @@ void
nsVolumeService::CheckMountLock(const nsAString& aMountLockName,
const nsAString& aMountLockState)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<nsVolume> vol = FindVolumeByMountLockName(aMountLockName);
@ -438,7 +438,7 @@ nsVolumeService::UpdateVolume(nsIVolume* aVolume, bool aNotifyObservers)
NS_IMETHODIMP
nsVolumeService::CreateFakeVolume(const nsAString& name, const nsAString& path)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsRefPtr<nsVolume> vol = new nsVolume(name, path, nsIVolume::STATE_INIT,
-1 /* mountGeneration */,
true /* isMediaPresent */,
@ -461,7 +461,7 @@ nsVolumeService::CreateFakeVolume(const nsAString& name, const nsAString& path)
NS_IMETHODIMP
nsVolumeService::SetFakeVolumeState(const nsAString& name, int32_t state)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsRefPtr<nsVolume> vol;
{
MonitorAutoLock autoLock(mArrayMonitor);
@ -489,7 +489,7 @@ nsVolumeService::SetFakeVolumeState(const nsAString& name, int32_t state)
NS_IMETHODIMP
nsVolumeService::RemoveFakeVolume(const nsAString& name)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
SetFakeVolumeState(name, nsIVolume::STATE_NOMEDIA);
RemoveVolumeByName(name);
return NS_OK;
@ -512,7 +512,7 @@ nsVolumeService::RemoveVolumeByName(const nsAString& aName)
}
mVolumeArray.RemoveElement(vol);
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
nsCOMPtr<nsIObserverService> obs = GetObserverService();
if (!obs) {
return;

View File

@ -720,7 +720,7 @@ NS_CreateTelephonyService()
{
nsCOMPtr<nsITelephonyService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
service = new mozilla::dom::telephony::TelephonyIPCService();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)

View File

@ -250,7 +250,7 @@ NS_CreateVoicemailService()
{
nsCOMPtr<nsIVoicemailService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
service = new mozilla::dom::voicemail::VoicemailIPCService();
} else {
#if defined(MOZ_B2G_RIL)

View File

@ -443,7 +443,7 @@ WifiCertService::~WifiCertService()
already_AddRefed<WifiCertService>
WifiCertService::FactoryCreate()
{
if (XRE_GetProcessType() != GeckoProcessType_Default) {
if (!XRE_IsParentProcess()) {
return nullptr;
}

Some files were not shown because too many files have changed in this diff Show More