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 90f3162b9e
commit 7323e89a40
201 changed files with 506 additions and 579 deletions

View File

@@ -398,7 +398,7 @@ nsIdleService::nsIdleService() : mCurrentlySetToTimeoutAt(TimeStamp()),
sLog = PR_NewLogModule("idleService");
MOZ_ASSERT(!gIdleService);
gIdleService = this;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (XRE_IsParentProcess()) {
mDailyIdle = new nsIdleServiceDaily(this);
mDailyIdle->Init();
}
@@ -425,7 +425,7 @@ nsIdleService::AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS)
// high either - no more than ~136 years.
NS_ENSURE_ARG_RANGE(aIdleTimeInS, 1, (UINT32_MAX / 10) - 1);
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
dom::ContentChild* cpc = dom::ContentChild::GetSingleton();
cpc->AddIdleObserver(aObserver, aIdleTimeInS);
return NS_OK;
@@ -484,7 +484,7 @@ nsIdleService::RemoveIdleObserver(nsIObserver* aObserver, uint32_t aTimeInS)
NS_ENSURE_ARG_POINTER(aObserver);
NS_ENSURE_ARG(aTimeInS);
if (XRE_GetProcessType() == GeckoProcessType_Content) {
if (XRE_IsContentProcess()) {
dom::ContentChild* cpc = dom::ContentChild::GetSingleton();
cpc->RemoveIdleObserver(aObserver, aTimeInS);
return NS_OK;