Hi Paul,

----- Original Message -----
> From: "Paul" <[email protected]>
> To: [email protected]
> Sent: Thursday, January 23, 2014 1:02:18 AM
> Subject: Re: [b2g] the execution of SystemWorkerManager in b2g
> 
> Hi Dave,
> 
> Thanks for you explanation.
> 
> Here are some questions that confuse me awhile.
> 
> 1. How libxul.so is loaded from the main b2g app ?
>    (Do you mean the main b2g app equals to b2g process?)

Yes b2g app == b2g process.

/system/b2g/libxul.so gets loaded here:
http://dxr.mozilla.org/mozilla-central/source/b2g/app/nsBrowserApp.cpp#215
eventually working down to here:
http://dxr.mozilla.org/mozilla-central/source/xpcom/glue/standalone/nsXPCOMGlue.cpp#256

> 2. In the gecko/hal/gonk folder, there are some files (such as GonkHal,
> GonkFMRadio and so on), these files also have their .o file in objdir-gecko.
> Say GonkHal.o, compared to SystemWorkerManager.o, I dont see any code to
> invoke this .o file. I dont understand how GonkHal.o gets linked or invoked
> by other files.

Those particular files get linked into libxul.so from the moz.build file in the 
directory above. moz.build controls exactly which .o files get included into 
libxul.so.

.o files aren't invoked. Functions are. To find out who calls a function, I 
normally use:
http://dxr.mozilla.org/mozilla-central/search?tree=mozilla-central&q=&redirect=true

For example, if you type GetTimezoneOffset (a function from GonkHal.cpp) then 
you'll see all of the places which refernce that (you may get more as well, 
since dxr is essentially doing a string search).

> 3. If I create a .o file, will that be okay to link this file to the b2g
> process and make it get invoked when the system boots up? If so, is there
> any example available in b2g source?

If you're building from source, sure. Getting things invoked really depends on 
what it is you're trying to do.

For example, the AutoMounter's InitAutoMounter function 
http://dxr.mozilla.org/mozilla-central/source/dom/system/gonk/AutoMounter.cpp#717
 is called from here: 
http://dxr.mozilla.org/mozilla-central/source/dom/system/gonk/SystemWorkerManager.cpp#242

The AutoMounter.cpp file is compiled into libxul.so because it's listed in the 
moz.build file here:
http://dxr.mozilla.org/mozilla-central/source/dom/system/gonk/moz.build#40

Dave Hylands
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to