Skip to content

Commit

Permalink
Backed out changeset 8b4e4083639e (bug 1171931) for B2G debug emulato…
Browse files Browse the repository at this point in the history
…r bustage.
  • Loading branch information
rvandermeulen committed Jun 25, 2015
1 parent 8750e33 commit 5f5c327
Show file tree
Hide file tree
Showing 201 changed files with 579 additions and 506 deletions.
6 changes: 3 additions & 3 deletions accessible/base/nsAccessibilityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ nsAccessibilityService::Init()
logging::CheckEnv();
#endif

if (XRE_IsParentProcess())
if (XRE_GetProcessType() == GeckoProcessType_Default)
gApplicationAccessible = new ApplicationAccessibleWrap();
else
gApplicationAccessible = new ApplicationAccessible();
Expand All @@ -1281,7 +1281,7 @@ nsAccessibilityService::Init()
gIsShutdown = false;

// Now its safe to start platform accessibility.
if (XRE_IsParentProcess())
if (XRE_GetProcessType() == GeckoProcessType_Default)
PlatformInit();

return true;
Expand Down Expand Up @@ -1324,7 +1324,7 @@ nsAccessibilityService::Shutdown()

gIsShutdown = true;

if (XRE_IsParentProcess())
if (XRE_GetProcessType() == GeckoProcessType_Default)
PlatformShutdown();

gApplicationAccessible->Shutdown();
Expand Down
2 changes: 1 addition & 1 deletion accessible/base/nsAccessibilityService.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ IPCAccessibilityActive()
#ifdef MOZ_B2G
return false;
#else
return XRE_IsContentProcess() &&
return XRE_GetProcessType() == GeckoProcessType_Content &&
mozilla::Preferences::GetBool("accessibility.ipc_architecture.enabled", true);
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion accessible/base/nsCoreUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_IsContentProcess())
if (XRE_GetProcessType() == GeckoProcessType_Content)
return !parentTreeItem;

// Parent of docshell for tab document running in chrome process is root.
Expand Down
2 changes: 1 addition & 1 deletion accessible/windows/msaa/nsWinUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ nsWinUtils::MaybeStartWindowEmulation()

if (Compatibility::IsJAWS() || Compatibility::IsWE() ||
Compatibility::IsDolphin() ||
XRE_IsContentProcess()) {
XRE_GetProcessType() == GeckoProcessType_Content) {
RegisterNativeWindow(kClassNameTabContent);
sHWNDCache = new nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>(2);
return true;
Expand Down
12 changes: 6 additions & 6 deletions caps/DomainPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static nsresult
BroadcastDomainSetChange(DomainSetType aSetType, DomainSetChangeType aChangeType,
nsIURI* aDomain = nullptr)
{
MOZ_ASSERT(XRE_IsParentProcess(),
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default,
"DomainPolicy should only be exposed to the chrome process.");

nsTArray<ContentParent*> parents;
Expand All @@ -45,7 +45,7 @@ DomainPolicy::DomainPolicy() : mBlacklist(new DomainSet(BLACKLIST))
, mWhitelist(new DomainSet(WHITELIST))
, mSuperWhitelist(new DomainSet(SUPER_WHITELIST))
{
if (XRE_IsParentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
BroadcastDomainSetChange(NO_TYPE, ACTIVATE_POLICY);
}
}
Expand Down Expand Up @@ -112,7 +112,7 @@ DomainPolicy::Deactivate()
if (ssm) {
ssm->DeactivateDomainPolicy();
}
if (XRE_IsParentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
BroadcastDomainSetChange(NO_TYPE, DEACTIVATE_POLICY);
}
return NS_OK;
Expand Down Expand Up @@ -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_IsParentProcess())
if (XRE_GetProcessType() == GeckoProcessType_Default)
return BroadcastDomainSetChange(mType, ADD_DOMAIN, aDomain);

return NS_OK;
Expand All @@ -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_IsParentProcess())
if (XRE_GetProcessType() == GeckoProcessType_Default)
return BroadcastDomainSetChange(mType, REMOVE_DOMAIN, aDomain);

return NS_OK;
Expand All @@ -192,7 +192,7 @@ NS_IMETHODIMP
DomainSet::Clear()
{
mHashTable.Clear();
if (XRE_IsParentProcess())
if (XRE_GetProcessType() == GeckoProcessType_Default)
return BroadcastDomainSetChange(mType, CLEAR_DOMAINS);

return NS_OK;
Expand Down
4 changes: 2 additions & 2 deletions caps/nsScriptSecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_IsParentProcess(),
MOZ_ASSERT_IF(XRE_GetProcessType() == GeckoProcessType_Default,
!mDomainPolicy);
}

Expand Down Expand Up @@ -1502,7 +1502,7 @@ nsScriptSecurityManager::GetDomainPolicyActive(bool *aRv)
NS_IMETHODIMP
nsScriptSecurityManager::ActivateDomainPolicy(nsIDomainPolicy** aRv)
{
if (!XRE_IsParentProcess()) {
if (XRE_GetProcessType() != GeckoProcessType_Default) {
return NS_ERROR_SERVICE_NOT_AVAILABLE;
}

Expand Down
2 changes: 1 addition & 1 deletion docshell/base/nsDefaultURIFixup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
}
keyword.Trim(" ");

if (XRE_IsContentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Content) {
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (!contentChild) {
return NS_ERROR_NOT_AVAILABLE;
Expand Down
10 changes: 5 additions & 5 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ IncreasePrivateDocShellCount()
{
gNumberOfPrivateDocShells++;
if (gNumberOfPrivateDocShells > 1 ||
!XRE_IsContentProcess()) {
XRE_GetProcessType() != GeckoProcessType_Content) {
return;
}

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

if (XRE_IsContentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Content) {
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (contentChild) {
contentChild->SendNotifyKeywordSearchLoading(aProvider, aKeyword);
Expand Down
16 changes: 11 additions & 5 deletions dom/asmjscache/AsmJSCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ 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;
Expand Down Expand Up @@ -497,7 +503,7 @@ class MainProcessRunnable : public virtual FileDescriptorHolder
mIsApp(false),
mEnforcingQuota(true)
{
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(IsMainProcess());
}

virtual ~MainProcessRunnable()
Expand Down Expand Up @@ -1127,7 +1133,7 @@ class SingleProcessRunnable final : public File,
: MainProcessRunnable(aPrincipal, aOpenMode, aWriteParams),
mReadParams(aReadParams)
{
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(!NS_IsMainThread());
MOZ_COUNT_CTOR(SingleProcessRunnable);
}
Expand Down Expand Up @@ -1205,7 +1211,7 @@ class ParentProcessRunnable final : public PAsmJSCacheEntryParent,
mOpened(false),
mFinished(false)
{
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(NS_IsMainThread());
MOZ_COUNT_CTOR(ParentProcessRunnable);
}
Expand Down Expand Up @@ -1382,7 +1388,7 @@ class ChildProcessRunnable final : public File,
mActorDestroyed(false),
mState(eInitial)
{
MOZ_ASSERT(!XRE_IsParentProcess());
MOZ_ASSERT(!IsMainProcess());
MOZ_ASSERT(!NS_IsMainThread());
MOZ_COUNT_CTOR(ChildProcessRunnable);
}
Expand Down Expand Up @@ -1578,7 +1584,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 (XRE_IsParentProcess()) {
if (IsMainProcess()) {
file = new SingleProcessRunnable(aPrincipal, aOpenMode, aWriteParams,
aReadParams);
} else {
Expand Down
18 changes: 9 additions & 9 deletions dom/audiochannel/AudioChannelService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ AudioChannelService::GetAudioChannelService()
{
MOZ_ASSERT(NS_IsMainThread());

if (!XRE_IsParentProcess()) {
if (XRE_GetProcessType() != GeckoProcessType_Default) {
return AudioChannelServiceChild::GetAudioChannelService();
}

Expand All @@ -84,7 +84,7 @@ AudioChannelService::GetOrCreateAudioChannelService()
{
MOZ_ASSERT(NS_IsMainThread());

if (!XRE_IsParentProcess()) {
if (XRE_GetProcessType() != GeckoProcessType_Default) {
return AudioChannelServiceChild::GetOrCreateAudioChannelService();
}

Expand All @@ -104,7 +104,7 @@ AudioChannelService::GetOrCreateAudioChannelService()
void
AudioChannelService::Shutdown()
{
if (!XRE_IsParentProcess()) {
if (XRE_GetProcessType() != GeckoProcessType_Default) {
return AudioChannelServiceChild::Shutdown();
}

Expand All @@ -122,7 +122,7 @@ AudioChannelService::AudioChannelService()
, mDisabled(false)
, mDefChannelChildID(CONTENT_PROCESS_ID_UNKNOWN)
{
if (XRE_IsParentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->AddObserver(this, "ipc:content-shutdown", false);
Expand Down Expand Up @@ -180,7 +180,7 @@ AudioChannelService::RegisterType(AudioChannel aChannel, uint64_t aChildID,
AudioChannelInternalType type = GetInternalType(aChannel, true);
mChannelCounters[type].AppendElement(aChildID);

if (XRE_IsParentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {

// We must keep the childIds in order to decide which app is allowed to play
// with then telephony channel.
Expand Down Expand Up @@ -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_IsParentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {

if (aChannel == AudioChannel::Telephony) {
UnregisterTelephonyChild(aChildID);
Expand Down Expand Up @@ -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_IsParentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
// 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 &&
Expand Down Expand Up @@ -547,7 +547,7 @@ AudioChannelService::SetDefaultVolumeControlChannelInternal(int32_t aChannel,
bool aVisible,
uint64_t aChildID)
{
if (!XRE_IsParentProcess()) {
if (XRE_GetProcessType() != GeckoProcessType_Default) {
return;
}

Expand Down Expand Up @@ -590,7 +590,7 @@ AudioChannelService::SetDefaultVolumeControlChannelInternal(int32_t aChannel,
void
AudioChannelService::SendAudioChannelChangedNotification(uint64_t aChildID)
{
if (!XRE_IsParentProcess()) {
if (XRE_GetProcessType() != GeckoProcessType_Default) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion dom/base/Crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,

uint8_t* data = aArray.Data();

if (!XRE_IsParentProcess()) {
if (XRE_GetProcessType() != GeckoProcessType_Default) {
InfallibleTArray<uint8_t> randomValues;
// Tell the parent process to generate random values via PContent
ContentChild* cc = ContentChild::GetSingleton();
Expand Down
4 changes: 2 additions & 2 deletions dom/base/Navigator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_IsParentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
uint32_t memLevel = mozilla::hal::GetTotalSystemMemoryLevel();
if (memLevel == 0) {
p->MaybeReject(NS_ERROR_NOT_AVAILABLE);
Expand Down Expand Up @@ -2572,7 +2572,7 @@ Navigator::HasTVSupport(JSContext* aCx, JSObject* aGlobal)
bool
Navigator::IsE10sEnabled(JSContext* aCx, JSObject* aGlobal)
{
return XRE_IsContentProcess();
return XRE_GetProcessType() == GeckoProcessType_Content;
}

bool
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsCCUncollectableMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static void
MarkMessageManagers()
{
// The global message manager only exists in the root process.
if (!XRE_IsParentProcess()) {
if (XRE_GetProcessType() != GeckoProcessType_Default) {
return;
}
nsCOMPtr<nsIMessageBroadcaster> strongGlobalMM =
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsContentPermissionHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ nsContentPermissionUtils::AskPermission(nsIContentPermissionRequest* aRequest, n
NS_ENSURE_STATE(aWindow && aWindow->IsCurrentInnerWindow());

// for content process
if (XRE_IsContentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Content) {

nsRefPtr<RemotePermissionRequest> req =
new RemotePermissionRequest(aRequest, aWindow);
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10603,7 +10603,7 @@ PLDHashOperator UnlockEnumerator(imgIRequest* aKey,
nsresult
nsDocument::SetImageLockingState(bool aLocked)
{
if (XRE_IsContentProcess() &&
if (XRE_GetProcessType() == GeckoProcessType_Content &&
!Preferences::GetBool("image.mem.allow_locking_in_content_processes", true)) {
return NS_OK;
}
Expand Down
4 changes: 2 additions & 2 deletions dom/base/nsFocusManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_IsParentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
ActivateOrDeactivate(window, true);
}

Expand Down Expand Up @@ -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_IsParentProcess()) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
ActivateOrDeactivate(window, false);
}

Expand Down
Loading

0 comments on commit 5f5c327

Please sign in to comment.