上一篇中分析了从浏览器初始化到extension框架的依赖图的创建过程,这一过程结束时系统extension框架所需的主要工厂对象及其相互依赖关系已经创建起来了,但是各种具体对象并没有创建起来,这里以extensionservice的创建过程为例进行分析具体service的创建:
从ChromeBrowserMainParts::PreMainMessageLoopRunImpl方法调用PreProfileInit();方法结束开始继续进行分析,以CreatePrimaryProfile方法为入口,大致上可以分为两个过程:ExtensionSystemImpl的创建和ExtensionService的创建及初始化,总体上的时序图如下所示:
这里只关注主要流程,首先是通过ProfileManager::GetProfile获取当前的profile(profile实际上就是一个数据绑定,Chromium has lots of features that hook into aProfile, a bundle of data about the current user and the current chrome session that can span multiple browser windows,其架构可以参见chromium技术文档:http://dev.chromium.org/developers/design-docu