宏观视角阐述chromium的多进程架构
总览
主进程——UI进程、browser进程,管理tab、插件;
render进程——使用blink引擎排版、渲染网页;

管理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进程
异常检测
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
内存回收
插件
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
537

被折叠的 条评论
为什么被折叠?



