Bug 965912 - Initialize DateCacheCleaner (which registers an observer to the chrome process) after forking from the Nuwa process. r=khuey

This commit is contained in:
Cervantes Yu 2014-02-14 16:43:51 +08:00
parent 0a498d5914
commit 9801876ee5
3 changed files with 19 additions and 4 deletions

View File

@ -134,6 +134,7 @@
#include "AudioChannelService.h"
#include "JavaScriptChild.h"
#include "mozilla/dom/telephony/PTelephonyChild.h"
#include "mozilla/dom/time/DateCacheCleaner.h"
#include "mozilla/net/NeckoMessageUtils.h"
using namespace base;
@ -311,6 +312,15 @@ NS_IMPL_ISUPPORTS1(SystemMessageHandledObserver, nsIObserver)
ContentChild* ContentChild::sSingleton;
// Performs initialization that is not fork-safe, i.e. that must be done after
// forking from the Nuwa process.
static void
InitOnContentProcessCreated()
{
// This will register cross-process observer.
mozilla::dom::time::InitializeDateCacheCleaner();
}
ContentChild::ContentChild()
: mID(uint64_t(-1))
#ifdef ANDROID
@ -462,6 +472,10 @@ ContentChild::InitXPCOM()
nsRefPtr<SystemMessageHandledObserver> sysMsgObserver =
new SystemMessageHandledObserver();
sysMsgObserver->Init();
#ifndef MOZ_NUWA_PROCESS
InitOnContentProcessCreated();
#endif
}
PMemoryReportRequestChild*
@ -1623,6 +1637,10 @@ public:
toplevel = toplevel->getNext();
}
// Perform other after-fork initializations.
InitOnContentProcessCreated();
return NS_OK;
}
};

View File

@ -66,7 +66,7 @@ CrashReporterParent::CrashReporterParent()
#ifdef MOZ_CRASHREPORTER
mNotes(4),
#endif
mStartTime(time(nullptr))
mStartTime(::time(nullptr))
, mInitialized(false)
{
MOZ_COUNT_CTOR(CrashReporterParent);

View File

@ -130,7 +130,6 @@ using namespace mozilla;
using namespace mozilla::net;
using namespace mozilla::dom;
using namespace mozilla::dom::ipc;
using namespace mozilla::dom::time;
nsrefcnt nsLayoutStatics::sLayoutStaticRefcnt = 0;
@ -280,8 +279,6 @@ nsLayoutStatics::Initialize()
nsCookieService::AppClearDataObserverInit();
nsApplicationCacheService::AppClearDataObserverInit();
InitializeDateCacheCleaner();
HTMLVideoElement::Init();
CacheObserver::Init();