多进程架构

Multi-process Architecture

宏观视角阐述chromium的多进程架构

总览

主进程——UI进程、browser进程,管理tab、插件;

render进程——使用blink引擎排版、渲染网页;

Blink (Rendering Engine)


 

管理render进程

Managing render processes

每个render进程有一个全局object RenderProcess,同理,每个browser进程有一个RenderProcessHost

RenderProcess   <----ipc---->RenderProcessHost 

Inter-process Communication (IPC)

管理Views

RenderProcess  <----->RenderView <----->RenderViewHost<----->RenderProcessHost

                           <----->RenderView <----->RenderViewHost<----->

                           <----->RenderView <----->RenderViewHost<----->

组件与接口

RenderWidgetHost handles the input and painting for RenderWidget int hte bro

For more detailed information on how this embedding works, see the How Chromium displays web pages design document.

共享render进程

通常情况,每个新窗口或者tab页会在一个新的进程打开。browser会创建一个单独的RenderView.

然而,有时候想在多windows或者tabs之间共享render进程。

A web application opens a new window that it expects to communicate with synchronously, for example, using window.open in JavaScript. In this case, when we create a new window or tab, we need to reuse the process that the window was opened with. 

We also have strategies to assign new tabs to existing processes if the total number of processes is too large, or if the user already has a process open navigated to that domain. 

用 js window.open方式打开的网页 与原网页共享 同一个render进程

Process Models

异常检测

Each IPC connection to a browser process watches the process handles. If these handles are signaled, the render process has crashed and the tabs are notified of the crash. For now, we show a "sad tab" screen that notifies the user that the renderer has crashed. The page can be reloaded by pressing the reload button or by starting a new navigation. When this happens, we notice that there is no process and create a new one.

sandbox 

Sandbox

内存回收

插件

Firefox-style NPAPI plug-ins ran in their own process, separate from renderers. This is described in detail in Plugin Architecture.

The Site Isolation project aims to provide more isolation between renderers, an early deliverable for this project includes running Chrome's HTML/JavaScript content extensions in isolated processes.


 

​​​​​​https://www.chromium.org/developers/design-documents/inter-process-communication/


How Chromium Displays Web Pages

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值