ffos: 点击一个web app图标到完成相应进程并正常运行过程分析
https://blog.****.net/hunter___/article/details/83141151
https://blog.****.net/hunter___/article/details/83180552
https://blog.****.net/hunter___/article/details/83105479
https://blog.****.net/hunter___/article/details/82968186
ffos 上的app的启动过程分析:
TODO:
0.gecko 到gaia的应用框架,通路。
1.home screen 如何将消息传给b2g。
2.web app 与其他APP ,b2g都进行了哪些类型的交互。
0.gecko 到gaia的应用框架,通路。
(1)gaia, system app ,homescreen_window.js
(2)homescreen 应用,展示图标,并将点击的图标与实际应用链接起来。显示窗口??
Log 分析:
gecko/dom/ipc/extensions.js:7:dump("######################## extensions.js loaded\n");
gecko/b2g/components/SystemAppProxy.jsm:128: dump('XXX FIXME : Dispatch a ' + type + ': ' + details.type + "\n");
toolkit/mozapps/extensions/content/extensions.xul:27: src="chrome://mozapps/content/extensions/extensions.js"/>
toolkit/mozapps/extensions/jar.mn:9:* content/mozapps/extensions/extensions.js (content/extensions.js)
dom/browser-element/BrowserElementParent.js:344: this._mm.loadFrameScript("chrome://global/content/extensions.js", true);
一。home screen 到 b2g 的load请求
加载好iframe window 等才调ContentParent::CreateBrowserOrApp() 创建应用。
homescreen app.js主要是负责app从图标到icon.launch()的作用。
window.js控制window里的情况,滚动等。
初步判断,home screen 进程收到js 传来的icon图标点击请求 icon.launch,b2g 调度webapps-launch, communication/Message/camera 进程有反应加载一些什么,b2g 将通道改变,重新生成新模板进程。
system app 的转发有吗?笨,system app 就是b2g。
communication
message
camera
//home screen app
I/GeckoDump( 5971): jslogpan, call -- // App launching --->
I/GeckoDump( 5971): jslogpan, call -- icon = e.detail.target.firstElementChild; --->
I/GeckoDump( 5971): jslogpan, call -- icon.launch(); --->
//b2g /system app
I/Gecko ( 179): XXX FIXME : Dispatch a webapps-launch: undefined
//communication app
I/Gecko ( 1226): ###################################### forms.js loaded
I/Gecko ( 1226): ###################################### BrowserElementCopyPaste.js loaded
I/Gecko ( 1226): ############################### browserElementPanning.js loaded
I/Gecko ( 1226): ######################## BrowserElementChildPreload.js loaded
I/Gecko ( 1226): ######################## extensions.js loaded
W/Communications( 1226): [JavaScript Warning: "Property contained reference to invalid variable. Error in parsing value for 'transition-delay'. Falling back to 'initial'." {file: "app://communications.gaiamobile.org/shared/style/edit_mode.css" line: 14 column: 257 source: " visibility var(--transition-duration)"}]
W/Communications( 1226): [JavaScript Warning: "Property contained reference to invalid variable. Error in parsing value for 'transition-duration'. Falling back to 'initial'." {file: "app://communications.gaiamobile.org/shared/style/edit_mode.css" line: 14 column: 257 source: " visibility var(--transition-duration)"}]
W/Communications( 1226): [JavaScript Warning: "Property contained reference to invalid variable. Error in parsing value for 'transition-property'. Falling back to 'initial'." {file: "app://communications.gaiamobile.org/shared/style/edit_mode.css" line: 14 column: 257 source: " visibility var(--transition-duration)"}]
W/Communications( 1226): [JavaScript Warning: "Property contained reference to invalid variable. Error in parsing value for 'transition-timing-function'. Falling back to 'initial'." {file: "app://communications.gaiamobile.org/shared/style/edit_mode.css" line: 14 column: 257 source: " visibility var(--transition-duration)"}]
I/Gecko ( 179): XXX FIXME : Dispatch a mozChromeEvent: default-volume-channel-changed
I/Gecko ( 179): -*- ContactDB component: upgrade schema from: 0 to 20 called!
I/Communications( 1226): Content JS INFO: Idle event!!!. FB Migration about to start
I/Communications( 1226): at onidle (app://communications.gaiamobile.org/contacts/js/fb/datastore_migrator.js:293:5)
W/Communications( 1226): Content JS WARN: FB Migration: The database does not exist
W/Communications( 1226): at DatastoreMigration/DatastoreMigrator/openIndexedDB/req.onsuccess (app://communications.gaiamobile.org/contacts/js/fb/datastore_migrator.js:212:11)
问题,system app(b2g 如何表现)
如何与普通app 交互?
grep -rn "XXX FIXME : Dispatch a"
|
普通app 到b2g的 代理b2g/components/SystemAppProxy.jsm
极精简的文件。
gecko/b2g/..runapp.js SystemappProxy.jsm
gecko/b2g/chrome/content/runapp.js
gaia/..system app:
homescreen_launcher.js 启动hsc,
homescreen_window.js 对hsc窗口的一些设置
homescreen_window_manager.js 管理窗口的隐藏显示
applications.js app的信息,如安装列表等
gaia/apps/homescreen/ js文件,实现app图标等各种操作。
homescreen_launcher.js
homescreen_window_manager.js
参考构架图:
https://blog.****.net/hunter___/article/details/83016461
系统构架:
应用间消息传递:
功能模块架构:
ipc模块:
https://github.com/sotaroikeda/firefox-diagrams/blob/master/ipc/ipc_PBackground_FirefoxOS_2_2.pdf
参考:Android:
https://blog.****.net/freekiteyu/article/details/79318031