fork 之后分两条线,
b2g 进程:
main(b2g process)--> b2g_main--->do_main-->
startup xpcom 的过程:
main()->RunProcesses()->b2g_main()->do_main()->XRE_main->ScopedXPCOMStartup::Initialize()->NS_InitXPCOM2()
nuwa/content进程:
main(nuwa process)-->?
在b2g process 这边,b2g loader fork 出nuwa后,回收僵尸进程以及调XRE_ProcLoaderClientInit对b2g loader client进行初始化,接着b2g_main启动b2g process ,具体来说就是startthreadpool() 用于binder ipc相关的通信,同时调do_main()-->XRE_main进行后续操作。
b2g_main()的主要作用是启动b2g process,具体如下:
android::ProcessState::self()->startThreadPool();//binder ipc 相关,线程池,注册主线程
rv = XPCOMGlueLoadXULFunctions(kXULFuncs);//又一次,做
result = do_main(argc, _argv);//主要接着去调XRE_main()
#ifdef MOZ_WIDGET_GONK
// This creates a ThreadPool for binder ipc. A ThreadPool is necessary to
// receive binder calls, though not necessary to send binder calls.
// ProcessState::Self() also needs to be called once on the main thread to
// register the main thread with the binder driver.
P_LOGI("call startThreadPool--->");
android::ProcessState::self()->startThreadPool();
#endif
在b2g process 中:
do_main()只做了以下事情:
mozilla::StartBootAnimation();//开机动画
return XRE_main(argc, argv, &sAppData, 0);//继续XRE_
XRE_main()做了哪些事情呢???
做了非常多的核心工作,
XRE_main (int argc, char *argv[], const nsXREAppData *aAppData)
{
int result = XRE_mainInit(&exit);
result = XRE_mainStartup(&exit);
mScopedXPCOM = MakeUnique<ScopedXPCOMStartup>();
rv = mScopedXPCOM->Initialize();
rv = XRE_mainRun();
}
(1)XRE_maininit() 检查appdata override 及其正确性,获取其二进制文件地址??配置crashreporter 的属性等
(2)XRE_mainStartup()检查版本 ,兼容性,setprofile ,检查gecko更新?,GTK初始化,crashreporter崩溃报告等
(3)mScopedXPCOM->Initialize() 初始化xpcom,
(4) XRE_mainRun() 去跑gecko app
MakeUnique ≈ new
mScopedXPCOM = MakeUnique<ScopedXPCOMStartup>();
new ScopedXPCOMStartup;
/**
* MakeUnique is a helper function for allocating new'd objects and arrays,
* returning a UniquePtr containing the resulting pointer. The semantics of
* MakeUnique<Type>(...) are as follows.
*
* If Type is an array T[n]:
* Disallowed, deleted, no overload for you!
* If Type is an array T[]:
* MakeUnique<T[]>(size_t) is the only valid overload. The pointer returned
* is as if by |new T[n]()|, which value-initializes each element. (If T
* isn't a class type, this will zero each element. If T is a class type,
* then roughly speaking, each element will be constructed using its default
* constructor. See C++11 [dcl.init]p7 for the full gory details.)
* If Type is non-array T:
* The arguments passed to MakeUnique<T>(...) are forwarded into a
* |new T(...)| call, initializing the T as would happen if executing
* |T(...)|.
*
* There are various benefits to using MakeUnique instead of |new| expressions.
*
* First, MakeUnique eliminates use of |new| from code entirely. If objects are
* only created through UniquePtr, then (assuming all explicit release() calls
* are safe, including transitively, and no type-safety casting funniness)
* correctly maintained ownership of the UniquePtr guarantees no leaks are
* possible. (This pays off best if a class is only ever created through a
* factory method on the class, using a private constructor.)
*
* Second, initializing a UniquePtr using a |new| expression requires repeating
* the name of the new'd type, whereas MakeUnique in concert with the |auto|
* keyword names it only once:
*
* UniquePtr<char> ptr1(new char()); // repetitive
* auto ptr2 = MakeUnique<char>(); // shorter
*
* Of course this assumes the reader understands the operation MakeUnique
* performs. In the long run this is probably a reasonable assumption. In the
* short run you'll have to use your judgment about what readers can be expected
* to know, or to quickly look up.
*
* Third, a call to MakeUnique can be assigned directly to a UniquePtr. In
* contrast you can't assign a pointer into a UniquePtr without using the
* cumbersome reset().
*
* UniquePtr<char> p;
* p = new char; // ERROR
* p.reset(new char); // works, but fugly
* p = MakeUnique<char>(); // preferred
*
* (And third, although not relevant to Mozilla: MakeUnique is exception-safe.
* An exception thrown after |new T| succeeds will leak that memory, unless the
* pointer is assigned to an object that will manage its ownership. UniquePtr
* ably serves this function.)
*/
template<typename T, typename... Args>
typename detail::UniqueSelector<T>::SingleObject
MakeUnique(Args&&... aArgs)
{
return UniquePtr<T>(new T(Forward<Args>(aArgs)...));
}
template<typename T>
typename detail::UniqueSelector<T>::UnknownBound
MakeUnique(decltype(sizeof(int)) aN)
{
typedef typename RemoveExtent<T>::Type ArrayType;
return UniquePtr<T>(new ArrayType[aN]());
}
template<typename T, typename... Args>
typename detail::UniqueSelector<T>::KnownBound
MakeUnique(Args&&... aArgs) = delete;
} // namespace mozilla
new ScopedXPCOMStartup
nsIServiceManager* mServiceManager;
/**
* Because we're starting/stopping XPCOM several times in different scenarios,
* this class is a stack-based critter that makes sure that XPCOM is shut down
* during early returns.
*/
class ScopedXPCOMStartup
{
public:
ScopedXPCOMStartup() :
mServiceManager(nullptr) { }
~ScopedXPCOMStartup();
nsresult Initialize();
nsresult SetWindowCreator(nsINativeAppSupport* native);
static nsresult CreateAppSupport(nsISupports* aOuter, REFNSIID aIID, void** aResult);
private:
nsIServiceManager* mServiceManager;
static nsINativeAppSupport* gNativeAppSupport;
};
ScopedXPCOMStartup::
initialize()
rv = NS_InitXPCOM2(&mServiceManager, gDirServiceProvider->GetAppDir(),gDirServiceProvider);//初始化,获取相关xpcom 服务
nsCOMPtr<nsIComponentRegistrar> reg = do_QueryInterface(mServiceManager);//获取intrface (from xpt?)
NSMODULE_DEFN(Apprunner) = &kXREModule;
nsresult
ScopedXPCOMStartup::Initialize()
{
NS_ASSERTION(gDirServiceProvider, "Should not get here!");
nsresult rv;
rv = NS_InitXPCOM2(&mServiceManager, gDirServiceProvider->GetAppDir(),
gDirServiceProvider);
if (NS_FAILED(rv)) {
NS_ERROR("Couldn't start xpcom!");
mServiceManager = nullptr;
}
else {
nsCOMPtr<nsIComponentRegistrar> reg =
do_QueryInterface(mServiceManager);
NS_ASSERTION(reg, "Service Manager doesn't QI to Registrar.");
}
return rv;
}
关于mServiceManager:
gecko/xpcom/components/nsIServiceManager.idl
nsIServiceManager* mServiceManager;
###gecko/xpcom/components/nsIServiceManager.idl
#include "nsISupports.idl"
/**
* The nsIServiceManager manager interface provides a means to obtain
* global services in an application. The service manager depends on the
* repository to find and instantiate factories to obtain services.
*
* Users of the service manager must first obtain a pointer to the global
* service manager by calling NS_GetServiceManager. After that,
* they can request specific services by calling GetService. When they are
* finished they can NS_RELEASE() the service as usual.
*
* A user of a service may keep references to particular services indefinitely
* and only must call Release when it shuts down.
*/
[scriptable, uuid(8bb35ed9-e332-462d-9155-4a002ab5c958)]
interface nsIServiceManager : nsISupports
{
/**
* getServiceByContractID
*
* Returns the instance that implements aClass or aContractID and the
* interface aIID. This may result in the instance being created.
*
* @param aClass or aContractID : aClass or aContractID of object
* instance requested
* @param aIID : IID of interface requested
* @param result : resulting service
*/
void getService(in nsCIDRef aClass,
in nsIIDRef aIID,
[iid_is(aIID),retval] out nsQIResult result);
void getServiceByContractID(in string aContractID,
in nsIIDRef aIID,
[iid_is(aIID),retval] out nsQIResult result);
/**
* isServiceInstantiated
*
* isServiceInstantiated will return a true if the service has already
* been created, or throw otherwise
*
* @param aClass or aContractID : aClass or aContractID of object
* instance requested
* @param aIID : IID of interface requested
* @throws NS_ERROR_SERVICE_NOT_AVAILABLE if the service hasn't been
* instantiated
* @throws NS_NOINTERFACE if the IID given isn't supported by the object
*/
boolean isServiceInstantiated(in nsCIDRef aClass, in nsIIDRef aIID);
boolean isServiceInstantiatedByContractID(in string aContractID, in nsIIDRef aIID);
};
%{C++
// Observing xpcom autoregistration. Topics will be 'start' and 'stop'.
#define NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID "xpcom-autoregistration"
#ifdef MOZILLA_INTERNAL_API
#include "nsXPCOM.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#endif
%}
rv = NS_InitXPCOM2(&mServiceManager, gDirServiceProvider->GetAppDir(),gDirServiceProvider);
NS_InitXPCOM2()
gecko/xpcom/build/XPCOMInit.cpp
EXPORT_XPCOM_API(nsresult)
NS_InitXPCOM(nsIServiceManager** aResult,
nsIFile* aBinDirectory)
{
return NS_InitXPCOM2(aResult, aBinDirectory, nullptr);
}
...
// Note that on OSX, aBinDirectory will point to .app/Contents/Resources/browser
EXPORT_XPCOM_API(nsresult)
NS_InitXPCOM2(nsIServiceManager** aResult,
nsIFile* aBinDirectory,
nsIDirectoryServiceProvider* aAppFileLocationProvider)
{
static bool sInitialized = false;
if (sInitialized) {
return NS_ERROR_FAILURE;
}
sInitialized = true;
mozPoisonValueInit();
NS_LogInit();
mozilla::LogModule::Init();
JS_SetCurrentEmbedderTimeFunction(TimeSinceProcessCreation);
char aLocal;
profiler_init(&aLocal);
nsresult rv = NS_OK;
// We are not shutting down
gXPCOMShuttingDown = false;
// Initialize the available memory tracker before other threads have had a
// chance to start up, because the initialization is not thread-safe.
mozilla::AvailableMemoryTracker::Init();
#ifdef XP_UNIX
// Discover the current value of the umask, and save it where
// nsSystemInfo::Init can retrieve it when necessary. There is no way
// to read the umask without changing it, and the setting is process-
// global, so this must be done while we are still single-threaded; the
// nsSystemInfo object is typically created much later, when some piece
// of chrome JS wants it. The system call is specified as unable to fail.
nsSystemInfo::gUserUmask = ::umask(0777);
::umask(nsSystemInfo::gUserUmask);
#endif
// Set up chromium libs
NS_ASSERTION(!sExitManager && !sMessageLoop, "Bad logic!");
if (!AtExitManager::AlreadyRegistered()) {
sExitManager = new AtExitManager();
}
if (!MessageLoop::current()) {
sMessageLoop = new MessageLoopForUI(MessageLoop::TYPE_MOZILLA_UI);
sMessageLoop->set_thread_name("Gecko");
// Set experimental values for main thread hangs:
// 128ms for transient hangs and 8192ms for permanent hangs
sMessageLoop->set_hang_timeouts(128, 8192);
}
if (XRE_IsParentProcess() &&
!BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO)) {
UniquePtr<BrowserProcessSubThread> ioThread = MakeUnique<BrowserProcessSubThread>(BrowserProcessSubThread::IO);
base::Thread::Options options;
options.message_loop_type = MessageLoop::TYPE_IO;
if (NS_WARN_IF(!ioThread->StartWithOptions(options))) {
return NS_ERROR_FAILURE;
}
sIOThread = ioThread.release();
}
// Establish the main thread here.
rv = nsThreadManager::get()->Init();
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
// Set up the timer globals/timer thread
rv = nsTimerImpl::Startup();
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
#ifndef ANDROID
// If the locale hasn't already been setup by our embedder,
// get us out of the "C" locale and into the system
if (strcmp(setlocale(LC_ALL, nullptr), "C") == 0) {
setlocale(LC_ALL, "");
}
#endif
#if defined(XP_UNIX)
NS_StartupNativeCharsetUtils();
#endif
NS_StartupLocalFile();
StartupSpecialSystemDirectory();
nsDirectoryService::RealInit();
bool value;
if (aBinDirectory) {
rv = aBinDirectory->IsDirectory(&value);
if (NS_SUCCEEDED(rv) && value) {
nsDirectoryService::gService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR,
aBinDirectory);
}
}
if (aAppFileLocationProvider) {
rv = nsDirectoryService::gService->RegisterProvider(aAppFileLocationProvider);
if (NS_FAILED(rv)) {
return rv;
}
}
nsCOMPtr<nsIFile> xpcomLib;
nsDirectoryService::gService->Get(NS_GRE_BIN_DIR,
NS_GET_IID(nsIFile),
getter_AddRefs(xpcomLib));
MOZ_ASSERT(xpcomLib);
// set gGREBinPath
nsAutoString path;
xpcomLib->GetPath(path);
gGREBinPath = ToNewUnicode(path);
xpcomLib->AppendNative(nsDependentCString(XPCOM_DLL));
nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib);
if (!mozilla::Omnijar::IsInitialized()) {
mozilla::Omnijar::Init();
}
if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) {
#ifdef OS_WIN
CommandLine::Init(0, nullptr);
#else
nsCOMPtr<nsIFile> binaryFile;
nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
NS_GET_IID(nsIFile),
getter_AddRefs(binaryFile));
if (NS_WARN_IF(!binaryFile)) {
return NS_ERROR_FAILURE;
}
rv = binaryFile->AppendNative(NS_LITERAL_CSTRING("nonexistent-executable"));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCString binaryPath;
rv = binaryFile->GetNativePath(binaryPath);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
static char const* const argv = { strdup(binaryPath.get()) };
CommandLine::Init(1, &argv);
#endif
}
NS_ASSERTION(nsComponentManagerImpl::gComponentManager == nullptr,
"CompMgr not null at init");
// Create the Component/Service Manager
nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl();
NS_ADDREF(nsComponentManagerImpl::gComponentManager);
// Global cycle collector initialization.
if (!nsCycleCollector_init()) {
return NS_ERROR_UNEXPECTED;
}
// And start it up for this thread too.
nsCycleCollector_startup();
// Register ICU memory functions. This really shouldn't be necessary: the
// JS engine should do this on its own inside JS_Init, and memory-reporting
// code should call a JSAPI function to observe ICU memory usage. But we
// can't define the alloc/free functions in the JS engine, because it can't
// depend on the XPCOM-based memory reporting goop. So for now, we have
// this oddness.
mozilla::SetICUMemoryFunctions();
// Do the same for libogg.
ogg_set_mem_functions(OggReporter::CountingMalloc,
OggReporter::CountingCalloc,
OggReporter::CountingRealloc,
OggReporter::CountingFree);
#if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
// And for VPX.
vpx_mem_set_functions(VPXReporter::CountingMalloc,
VPXReporter::CountingCalloc,
VPXReporter::CountingRealloc,
VPXReporter::CountingFree,
memcpy,
memset,
memmove);
#endif
#ifdef MOZ_WEBM
// And for libnestegg.
// libnestegg expects that its realloc implementation will free
// the pointer argument when a size of 0 is passed in, so we need
// the special version of the counting realloc.
nestegg_set_halloc_func(NesteggReporter::CountingFreeingRealloc);
#endif
// Initialize the JS engine.
if (!JS_Init()) {
NS_RUNTIMEABORT("JS_Init failed");
}
rv = nsComponentManagerImpl::gComponentManager->Init();
if (NS_FAILED(rv)) {
NS_RELEASE(nsComponentManagerImpl::gComponentManager);
return rv;
}
if (aResult) {
NS_ADDREF(*aResult = nsComponentManagerImpl::gComponentManager);
}
// The iimanager constructor searches and registers XPT files.
// (We trigger the singleton's lazy construction here to make that happen.)
(void)XPTInterfaceInfoManager::GetSingleton();
// After autoreg, but before we actually instantiate any components,
// add any services listed in the "xpcom-directory-providers" category
// to the directory service.
nsDirectoryService::gService->RegisterCategoryProviders();
// Init SharedThreadPool (which needs the service manager).
SharedThreadPool::InitStatics();
// Init AbstractThread.
AbstractThread::InitStatics();
// Force layout to spin up so that nsContentUtils is available for cx stack
// munging.
nsCOMPtr<nsISupports> componentLoader =
do_GetService("@mozilla.org/moz/jsloader;1");
mozilla::scache::StartupCache::GetSingleton();
mozilla::AvailableMemoryTracker::Activate();
// Notify observers of xpcom autoregistration start
NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_CATEGORY,
nullptr,
NS_XPCOM_STARTUP_OBSERVER_ID);
#ifdef XP_WIN
CreateAnonTempFileRemover();
#endif
// We only want the SystemMemoryReporter running in one process, because it
// profiles the entire system. The main process is the obvious place for
// it.
if (XRE_IsParentProcess()) {
mozilla::SystemMemoryReporter::Init();
}
// The memory reporter manager is up and running -- register our reporters.
RegisterStrongMemoryReporter(new ICUReporter());
RegisterStrongMemoryReporter(new OggReporter());
#ifdef MOZ_VPX
RegisterStrongMemoryReporter(new VPXReporter());
#endif
#ifdef MOZ_WEBM
RegisterStrongMemoryReporter(new NesteggReporter());
#endif
mozilla::Telemetry::Init();
mozilla::HangMonitor::Startup();
mozilla::BackgroundHangMonitor::Startup();
const MessageLoop* const loop = MessageLoop::current();
sMainHangMonitor = new mozilla::BackgroundHangMonitor(
loop->thread_name().c_str(),
loop->transient_hang_timeout(),
loop->permanent_hang_timeout());
return NS_OK;
}
//
// NS_ShutdownXPCOM()
//
// The shutdown sequence for xpcom would be
//
// - Notify "xpcom-shutdown" for modules to release primary (root) references
// - Shutdown XPCOM timers
// - Notify "xpcom-shutdown-threads" for thread joins
// - Shutdown the event queues
// - Release the Global Service Manager
// - Release all service instances held by the global service manager
// - Release the Global Service Manager itself
// - Release the Component Manager
// - Release all factories cached by the Component Manager
// - Notify module loaders to shut down
// - Unload Libraries
// - Release Contractid Cache held by Component Manager
// - Release dll abstraction held by Component Manager
// - Release the Registry held by Component Manager
// - Finally, release the component manager itself
//
EXPORT_XPCOM_API(nsresult)
NS_ShutdownXPCOM(nsIServiceManager* aServMgr)
{
return mozilla::ShutdownXPCOM(aServMgr);
}
xpcom Init 主要包含如下调用:
EXPORT_XPCOM_API(nsresult)
NS_InitXPCOM2(nsIServiceManager** aResult,
nsIFile* aBinDirectory,
nsIDirectoryServiceProvider* aAppFileLocationProvider)
{
mozPoisonValueInit()
NS_LogInit()
Init()
JS_SetCurrentEmbedderTimeFunction()
profiler_init()
umask()
AtExitManager()
AlreadyRegistered()
current()
MessageLoopForUI()
XRE_IsParentProcess()
GetMessageLoop()
Startup()
setlocale()
NS_StartupNativeCharsetUtils()
NS_StartupLocalFile()
StartupSpecialSystemDirectory()
RealInit()
NS_GET_IID()
nsDependentCString()
IsInitialized()
nsComponentManagerImpl()
nsCycleCollector_init()
nsCycleCollector_startup()
SetICUMemoryFunctions()
NesteggReporter()
JS_Init()
GetSingleton()
InitStatics()
do_GetService()
Activate()
NS_CreateServicesFromCategory()
CreateAnonTempFileRemover()
RegisterStrongMemoryReporter()
ICUReporter()
BackgroundHangMonitor()
ShutdownXPCOM()
}
P_LOGI("the whole process: main()->RunProcesses()->b2g_main()->do_main()->XRE_main->ScopedXPCOMStartup::Initialize()->NS_InitXPCOM2()");
startup xpcom 的过程:
main()->RunProcesses()->b2g_main()->do_main()->XRE_main->ScopedXPCOMStartup::Initialize()->NS_InitXPCOM2()
NS_InitXPCOM2()主要的工作:
被XRE_main调用后,大的任务就是启动xpcom,细节为:创建如果是in XRE_IsParentProcess io thread,则创建main thread,并初始化线程管理器
rv=nsThreadManager::get()->Init()--->,启动读本地文件的模块,nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib)-->//读取xpt等接口二进制文件
mozilla::Omnijar::IsInitialized = false,call mozilla::Omnijar::Init()--->//???
Create the Component/Service Manage----
nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl()--->//创建组件管理器,
f (!JS_Init()),call JS_Init()--->//调用JS_Init 启动并初始化js 引擎,
The iimanager constructor searches and registers XPT files.---//搜索并注册xpt接口文件提供的组件
init SharedThreadPool ,by call SharedThreadPool::InitStatics()--->//初始化共享线程池
componentLoader = do_GetService('@mozilla.org/moz/jsloader;1')--->//通过xpcom方法拉起jsloader组件
NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_CATEGORY,nullptr,NS_XPCOM_STARTUP_OBSERVER_ID)//通知它开始自动注册组件
const MessageLoop* const loop = MessageLoop::current()--->//messageloop 一直在监听是否有新组件需要注册???
sMainHangMonitor=new mozilla::BackgroundHangMonitor(loop->thread_name().c_str(),loop->transient_hang_timeout(),loop->permanent_hang_timeout()) //将监听丢到后台去???
gecko/toolkit/xre/nsAppRunner.cpp:1584,Fuc:Initialize startup xpcom seccessed?? call do_QueryInterface(mServiceManager)-->
startup xpcom seccessed?? call do_QueryInterface(mServiceManager)-->//启动好xpcom后,开始调XRE_mainRun
gecko/toolkit/xre/nsAppRunner.cpp:4443, Fuc:XRE_main call XRE_mainRun--->
XRE_mainRun还会调一次NS_NS_InitXPCOM2???
总结:
startup xpcom 的过程:
main()->RunProcesses()->b2g_main()->do_main()->XRE_main->ScopedXPCOMStartup::Initialize()->NS_InitXPCOM2()
NS_InitXPCOM2()主要的工作:大的来说就是启动xpcom。细节为: 在XRE_IsParentProcess 中创建main thread,并初始化线程管理器,启动读本地文件的模块nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib)并读取xpt等接口二进制文件,new nsComponentManagerImpl()创建组件管理器,调用JS_Init 启动并初始化js 引擎,搜索并注册xpt接口文件提供的组件,初始化共享线程池,通过xpcom方法拉起jsloader组件,通知NS_CreateServicesFromCategory开始自动注册其他xpcom组件。还有一些函数如MessageLoop,BackgroundHangMonitor似乎是用来监听一些线程的状态?启动好xpcom后,XRE_main开始调XRE_mainRun.
log如下:
gecko/b2g/app/nsBrowserApp.cpp:197, Fuc:do_main call return XRE_main--->
gecko/b2g/app/nsBrowserApp.cpp:198, Fuc:do_main <<<<<<<<<<<<<<<<<<<<<<<<<<<ed.func
gecko/toolkit/xre/nsAppRunner.cpp:4546, Fuc:XRE_main >>>>>>>>>>>>>>>>>>>>>>>>>>>st.func
gecko/toolkit/xre/nsAppRunner.cpp:4548, Fuc:XRE_main call XRE_CreateStatsObjecti--->
gecko/toolkit/xre/nsAppRunner.cpp:4550, Fuc:XRE_main call main.XRE_main()--->
gecko/toolkit/xre/nsAppRunner.cpp:4380, Fuc:XRE_main ----------------------------------
gecko/toolkit/xre/nsAppRunner.cpp:4385, Fuc:XRE_main call profilerGuard--->
gecko/toolkit/xre/nsAppRunner.cpp:4395, Fuc:XRE_main gArgc:1,gArgv:/system/b2g/b2g
gecko/toolkit/xre/nsAppRunner.cpp:4417, Fuc:XRE_main call XRE_mainInit--->
gecko/toolkit/xre/nsAppRunner.cpp:3139, Fuc:XRE_mainInit ----------------------------------
gecko/toolkit/xre/nsAppRunner.cpp:3217, Fuc:XRE_mainInit chek for application.ini override
gecko/toolkit/xre/nsAppRunner.cpp:3253, Fuc:XRE_mainInit XRE_GetBinaryPath-->
gecko/toolkit/xre/nsAppRunner.cpp:3300, Fuc:XRE_mainInit mDirProvider.Initialize-->
gecko/toolkit/xre/nsAppRunner.cpp:3309, Fuc:XRE_mainInit MOZ_CRASHREPORTER
gecko/toolkit/xre/nsAppRunner.cpp:3503, Fuc:XRE_mainInit call XRE_InitCommandLine()-->
gecko/toolkit/xre/nsAppRunner.cpp:4560, Fuc:XRE_InitCommandLine ----------------------------------
gecko/toolkit/xre/nsAppRunner.cpp:4572, Fuc:XRE_InitCommandLine XRE_GetBinaryPath(aArgv:/system/b2g/b2g)--->
gecko/toolkit/xre/nsAppRunner.cpp:3526, Fuc:XRE_mainInit <<<<<<<<<<<<<<<<<<<<<<<<<<<ed.func
gecko/toolkit/xre/nsAppRunner.cpp:4423, Fuc:XRE_main XRE_mainStartup--->
gecko/toolkit/xre/nsAppRunner.cpp:3657, Fuc:XRE_mainStartup ----------------------------------
gecko/toolkit/xre/nsAppRunner.cpp:3663, Fuc:XRE_mainStartup call SetShutdownChecks()-->
gecko/toolkit/xre/nsAppRunner.cpp:3963, Fuc:XRE_mainStartup call BuildVersion-->
gecko/toolkit/xre/nsAppRunner.cpp:4049, Fuc:XRE_mainStartup <<<<<<<<<<<<<<<<<<<<<<<<<<<ed.func
gecko/toolkit/xre/nsAppRunner.cpp:4431, Fuc:XRE_main call MakeUnique--->
gecko/toolkit/xre/nsAppRunner.cpp:4436, Fuc:XRE_main ----------------------------------
gecko/toolkit/xre/nsAppRunner.cpp:4437, Fuc:XRE_main ScopedXPCOMStartup::Initialize()
gecko/toolkit/xre/nsAppRunner.cpp:4438, Fuc:XRE_main rv = mScopedXPCOM->Initialize()--->
gecko/toolkit/xre/nsAppRunner.cpp:1571, Fuc:Initialize ----------------------------------
gecko/toolkit/xre/nsAppRunner.cpp:1573, Fuc:Initialize ----------------------------------
gecko/toolkit/xre/nsAppRunner.cpp:1575, Fuc:Initialize ---here ,startup xpcom---
gecko/toolkit/xre/nsAppRunner.cpp:1576, Fuc:Initialize ScopedXPCOMStartup::Initialize,call NS_InitXPCOM2-->
gecko/xpcom/build/XPCOMInit.cpp:512, Fuc:NS_InitXPCOM2 ----------------------------------
gecko/xpcom/build/XPCOMInit.cpp:513, Fuc:NS_InitXPCOM2 the whole process: main()->RunProcesses()->b2g_main()->do_main()->XRE_main->ScopedXPCOMStartup::Initialize()->NS_InitXPCOM2()
gecko/xpcom/build/XPCOMInit.cpp:514, Fuc:NS_InitXPCOM2 ----------------------------------
gecko/xpcom/build/XPCOMInit.cpp:560, Fuc:NS_InitXPCOM2 MessageLoop::current = false
gecko/xpcom/build/XPCOMInit.cpp:570, Fuc:NS_InitXPCOM2 in XRE_IsParentProcess io thread for what?---
gecko/xpcom/build/XPCOMInit.cpp:583, Fuc:NS_InitXPCOM2 Establish the main thread here.
gecko/xpcom/build/XPCOMInit.cpp:584, Fuc:NS_InitXPCOM2 rv = nsThreadManager::get()->Init()--->
gecko/xpcom/build/XPCOMInit.cpp:607, Fuc:NS_InitXPCOM2 call NS_StartupLocalFile()--->
gecko/xpcom/build/XPCOMInit.cpp:618, Fuc:NS_InitXPCOM2 aBinDirectory = true --
gecko/xpcom/build/XPCOMInit.cpp:626, Fuc:NS_InitXPCOM2 aAppFileLocationProvider = true,call RegisterProvider()-->
gecko/xpcom/build/XPCOMInit.cpp:634, Fuc:NS_InitXPCOM2 nsDirectoryService::gService->Get()--->
gecko/xpcom/build/XPCOMInit.cpp:646, Fuc:NS_InitXPCOM2 nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib)-->
gecko/xpcom/build/XPCOMInit.cpp:650, Fuc:NS_InitXPCOM2 mozilla::Omnijar::IsInitialized = false,call mozilla::Omnijar::Init()--->
gecko/xpcom/build/XPCOMInit.cpp:689, Fuc:NS_InitXPCOM2 Create the Component/Service Manage----
gecko/xpcom/build/XPCOMInit.cpp:690, Fuc:NS_InitXPCOM2 nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl()--->
gecko/xpcom/build/XPCOMInit.cpp:700, Fuc:NS_InitXPCOM2 call nsCycleCollector_startup()--->
gecko/xpcom/build/XPCOMInit.cpp:737, Fuc:NS_InitXPCOM2 ----- Initialize the JS engine -----
gecko/xpcom/build/XPCOMInit.cpp:738, Fuc:NS_InitXPCOM2 if (!JS_Init()),call JS_Init()--->
gecko/xpcom/build/XPCOMInit.cpp:742, Fuc:NS_InitXPCOM2 call rv = nsComponentManagerImpl::gComponentManager->Init()--->
gecko/xpcom/build/XPCOMInit.cpp:755, Fuc:NS_InitXPCOM2 The iimanager constructor searches and registers XPT files.---
gecko/xpcom/build/XPCOMInit.cpp:756, Fuc:NS_InitXPCOM2 (void)XPTInterfaceInfoManager::GetSingleton()--->
gecko/xpcom/build/XPCOMInit.cpp:762, Fuc:NS_InitXPCOM2 nsDirectoryService::gService->RegisterCategoryProviders()-->
gecko/xpcom/build/XPCOMInit.cpp:766, Fuc:NS_InitXPCOM2 init SharedThreadPool ,by call SharedThreadPool::InitStatics()--->
gecko/xpcom/build/XPCOMInit.cpp:770, Fuc:NS_InitXPCOM2 AbstractThread::InitStatics()--->
gecko/xpcom/build/XPCOMInit.cpp:775, Fuc:NS_InitXPCOM2 do_GetService of jsloader----
gecko/xpcom/build/XPCOMInit.cpp:776, Fuc:NS_InitXPCOM2 componentLoader = do_GetService('@mozilla.org/moz/jsloader;1')--->
gecko/xpcom/build/XPCOMInit.cpp:784, Fuc:NS_InitXPCOM2 // Notify observers of xpcom autoregistration star//
gecko/xpcom/build/XPCOMInit.cpp:785, Fuc:NS_InitXPCOM2 NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_CATEGORY,nullptr,NS_XPCOM_STARTUP_OBSERVER_ID) --->
gecko/xpcom/build/XPCOMInit.cpp:797, Fuc:NS_InitXPCOM2 XRE_IsParentProcess =true,call mozilla::SystemMemoryReporter::Init()--->
gecko/xpcom/build/XPCOMInit.cpp:811, Fuc:NS_InitXPCOM2 mozilla::Telemetry::Init()--->
gecko/xpcom/build/XPCOMInit.cpp:813, Fuc:NS_InitXPCOM2 mozilla::HangMonitor::Startup()--->
gecko/xpcom/build/XPCOMInit.cpp:815, Fuc:NS_InitXPCOM2 mozilla::BackgroundHangMonitor::Startup()--->
gecko/xpcom/build/XPCOMInit.cpp:817, Fuc:NS_InitXPCOM2 const MessageLoop* const loop = MessageLoop::current()--->
gecko/xpcom/build/XPCOMInit.cpp:819, Fuc:NS_InitXPCOM2 sMainHangMonitor = new mozilla::BackgroundHangMonitor(loop->thread_name().c_str(),loop->transient_hang_timeout(),loop->permanent_hang_timeout())
gecko/toolkit/xre/nsAppRunner.cpp:1584, Fuc:Initialize startup xpcom seccessed?? call do_QueryInterface(mServiceManager)-->
gecko/toolkit/xre/nsAppRunner.cpp:4443, Fuc:XRE_main call XRE_mainRun--->
gecko/toolkit/xre/nsAppRunner.cpp:4060, Fuc:XRE_mainRun ----------------------------------
gecko/ipc/glue/ProcessUtils_linux.cpp:231, Fuc:ProcLoaderClientGeckoInit ----------------------------------
gecko/toolkit/xre/nsAppRunner.cpp:4088, Fuc:XRE_mainRun call SetWindowCreator--->
gecko/toolkit/xre/nsAppRunner.cpp:4141, Fuc:XRE_mainRun gDoMigration = 1 --->
gecko/toolkit/xre/nsAppRunner.cpp:4202, Fuc:XRE_mainRun call mDirProvider.DoStartup()--->
gecko/toolkit/xre/nsAppRunner.cpp:4215, Fuc:XRE_mainRun call appStartup->GetShuttingDown()-->
gecko/toolkit/xre/nsAppRunner.cpp:4295, Fuc:XRE_mainRun call GetObserverService()-->
gecko/toolkit/xre/nsAppRunner.cpp:4300, Fuc:XRE_mainRun appStartup->DoneStartingUp()-->
gecko/toolkit/xre/nsAppRunner.cpp:4338, Fuc:XRE_mainRun appStartup->Run()-->
gecko/ipc/glue/ProcessUtils_linux.cpp:317, Fuc:ProcLoaderLoad ----------------------------------
gecko/ipc/glue/ProcessUtils_linux.cpp:620, Fuc:ProcLoaderServiceRun call BackgroundHangMonitor::Allow()--->
gecko/ipc/glue/ProcessUtils_linux.cpp:622, Fuc:ProcLoaderServiceRun call XRE_DeinitCommandLine--->
gecko/ipc/glue/ProcessUtils_linux.cpp:629, Fuc:ProcLoaderServiceRun call task->DoWork()--->
gecko/toolkit/xre/nsAppRunner.cpp:4560, Fuc:XRE_InitCommandLine ----------------------------------
gecko/toolkit/xre/nsAppRunner.cpp:4572, Fuc:XRE_InitCommandLine XRE_GetBinaryPath(aArgv:/system/b2g/plugin-container)--->
gecko/toolkit/xre/nsAppRunner.cpp:4629, Fuc:XRE_InitCommandLine mozilla::Omnijar::Init(greOmni, appOmni)-->
gecko/ipc/glue/ProcessChild.cpp:46, Fuc:ProcessChild >>>>>>>>>>>>>>>>>>>>>>>>>>>st.func
gecko/ipc/glue/ProcessUtils_linux.cpp:269, Fuc:ProcLoaderClientDeinit ----------------------------------
gecko/xpcom/build/XPCOMInit.cpp:512, Fuc:NS_InitXPCOM2 ----------------------------------
gecko/xpcom/build/XPCOMInit.cpp:513, Fuc:NS_InitXPCOM2 the whole process: main()->RunProcesses()->b2g_main()->do_main()->XRE_main->ScopedXPCOMStartup::Initialize()->NS_InitXPCOM2()
gecko/xpcom/build/XPCOMInit.cpp:514, Fuc:NS_InitXPCOM2 ----------------------------------
gecko/xpcom/build/XPCOMInit.cpp:583, Fuc:NS_InitXPCOM2 Establish the main thread here.
gecko/xpcom/build/XPCOMInit.cpp:584, Fuc:NS_InitXPCOM2 rv = nsThreadManager::get()->Init()--->
gecko/xpcom/build/XPCOMInit.cpp:607, Fuc:NS_InitXPCOM2 call NS_StartupLocalFile()--->
gecko/xpcom/build/XPCOMInit.cpp:618, Fuc:NS_InitXPCOM2 aBinDirectory = true --
gecko/xpcom/build/XPCOMInit.cpp:626, Fuc:NS_InitXPCOM2 aAppFileLocationProvider = true,call RegisterProvider()-->
gecko/xpcom/build/XPCOMInit.cpp:634, Fuc:NS_InitXPCOM2 nsDirectoryService::gService->Get()--->
gecko/xpcom/build/XPCOMInit.cpp:646, Fuc:NS_InitXPCOM2 nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib)-->
gecko/xpcom/build/XPCOMInit.cpp:689, Fuc:NS_InitXPCOM2 Create the Component/Service Manage----
gecko/xpcom/build/XPCOMInit.cpp:690, Fuc:NS_InitXPCOM2 nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl()--->
gecko/xpcom/build/XPCOMInit.cpp:700, Fuc:NS_InitXPCOM2 call nsCycleCollector_startup()--->
gecko/xpcom/build/XPCOMInit.cpp:737, Fuc:NS_InitXPCOM2 ----- Initialize the JS engine -----
gecko/xpcom/build/XPCOMInit.cpp:738, Fuc:NS_InitXPCOM2 if (!JS_Init()),call JS_Init()--->
gecko/xpcom/build/XPCOMInit.cpp:742, Fuc:NS_InitXPCOM2 call rv = nsComponentManagerImpl::gComponentManager->Init()--->
gecko/xpcom/build/XPCOMInit.cpp:755, Fuc:NS_InitXPCOM2 The iimanager constructor searches and registers XPT files.---
gecko/xpcom/build/XPCOMInit.cpp:756, Fuc:NS_InitXPCOM2 (void)XPTInterfaceInfoManager::GetSingleton()--->
gecko/xpcom/build/XPCOMInit.cpp:762, Fuc:NS_InitXPCOM2 nsDirectoryService::gService->RegisterCategoryProviders()-->
gecko/xpcom/build/XPCOMInit.cpp:766, Fuc:NS_InitXPCOM2 init SharedThreadPool ,by call SharedThreadPool::InitStatics()--->
gecko/xpcom/build/XPCOMInit.cpp:770, Fuc:NS_InitXPCOM2 AbstractThread::InitStatics()--->
gecko/xpcom/build/XPCOMInit.cpp:775, Fuc:NS_InitXPCOM2 do_GetService of jsloader----
gecko/xpcom/build/XPCOMInit.cpp:776, Fuc:NS_InitXPCOM2 componentLoader = do_GetService('@mozilla.org/moz/jsloader;1')--->
gecko/xpcom/build/XPCOMInit.cpp:784, Fuc:NS_InitXPCOM2 // Notify observers of xpcom autoregistration star//
gecko/xpcom/build/XPCOMInit.cpp:785, Fuc:NS_InitXPCOM2 NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_CATEGORY,nullptr,NS_XPCOM_STARTUP_OBSERVER_ID) --->
gecko/xpcom/build/XPCOMInit.cpp:811, Fuc:NS_InitXPCOM2 mozilla::Telemetry::Init()--->
gecko/xpcom/build/XPCOMInit.cpp:813, Fuc:NS_InitXPCOM2 mozilla::HangMonitor::Startup()--->
gecko/xpcom/build/XPCOMInit.cpp:815, Fuc:NS_InitXPCOM2 mozilla::BackgroundHangMonitor::Startup()--->
gecko/xpcom/build/XPCOMInit.cpp:817, Fuc:NS_InitXPCOM2 const MessageLoop* const loop = MessageLoop::current()--->
gecko/xpcom/build/XPCOMInit.cpp:819, Fuc:NS_InitXPCOM2 sMainHangMonitor = new mozilla::BackgroundHangMonitor(loop->thread_name().c_str(),loop->transient_hang_timeout(),loop->permanent_hang_timeout())