Google Chrome如何将单个标签隔离到单独的进程中,同时看起来像单个应用程序? [英] How can Google Chrome isolate tabs into separate processes while looking like a single application?

查看:495
本文介绍了Google Chrome如何将单个标签隔离到单独的进程中,同时看起来像单个应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们被告知Google Chrome会在单独的进程中运行每个标签。因此,一个选项卡中的崩溃不会导致其他选项卡出现问题。



AFAIK,多进程主要用于没有GUI的程序。我从来没有读过任何可以将多个GUI过程嵌入到一个过程中的技术。



Chrome如何做到这一点?



我在问这个问题,因为我正在设计CCTV软件,它将使用来自多个相机制造商的视频解码SDK,其中一些远不稳定。所以我更喜欢以运行在不同的过程,我认为类似于铬这些SDK。


解决方案

基本上,他们使用的另一过程将它们全部粘贴到GUI中。



Google Chrome创建三种不同类型的流程:浏览器,渲染器和插件。



浏览器:只有一个浏览器进程管理浏览器的选项卡,窗口和chrome。此过程还处理与磁盘,网络,用户输入和显示的所有交互,但不会尝试解析或呈现网络中的任何内容。

渲染器:浏览器进程创建许多渲染器进程,每个进程负责呈现网页。渲染器进程包含处理HTML,JavaScript,CSS,图像等的所有复杂逻辑。 Chrome使用开源的WebKit渲染引擎实现了这一点,苹果的Safari浏览器也使用该渲染引擎。每个渲染器进程都在沙箱中运行,这意味着它几乎不能直接访问磁盘,网络或显示器。所有与Web应用程序的交互(包括用户输入事件和屏幕绘画)都必须通过浏览器进程。这让浏览器进程监控可疑的活动的渲染器,杀死他们,如果怀疑一个漏洞发生



插件:浏览器进程还为正在使用的各种类型的插件(如Flash,Quicktime或Adobe Reader)创建一个进程。这些进程只包含插件本身,以及一些粘合代码,以便让它们与浏览器和渲染器进行交互。



来源: Chromium博客:多进程架构


We have been told that Google Chrome runs each tab in a separate process. Therefore a crash in one tab would not cause problems in the other tabs.

AFAIK, multi-processes are mostly used in programs without a GUI. I have never read any technique that could embed multiple GUI processes into a single one.

How does Chrome do that?

I am asking this question because I am designing CCTV software which will use video decoding SDKs from multiple camera manufactures, some of which are far from stable. So I prefer to run these SDKs in different processes, which I thought is similar to Chrome.

解决方案

Basically, they use another process that glues them all together into the GUI.

Google Chrome creates three different types of processes: browser, renderers, and plug-ins.

Browser: There's only one browser process, which manages the tabs, windows, and "chrome" of the browser. This process also handles all interactions with the disk, network, user input, and display, but it makes no attempt to parse or render any content from the web.

Renderers: The browser process creates many renderer processes, each responsible for rendering web pages. The renderer processes contain all the complex logic for handling HTML, JavaScript, CSS, images, and so on. Chrome achieves this using the open source WebKit rendering engine, which is also used by Apple's Safari web browser. Each renderer process is run in a sandbox, which means it has almost no direct access to the disk, network, or display. All interactions with web apps, including user input events and screen painting, must go through the browser process. This lets the browser process monitor the renderers for suspicious activity, killing them if it suspects an exploit has occurred.

Plug-ins: The browser process also creates one process for each type of plug-in that is in use, such as Flash, Quicktime, or Adobe Reader. These processes just contain the plug-ins themselves, along with some glue code to let them interact with the browser and renderers.

Source: Chromium Blog: Multi-process Architecture

这篇关于Google Chrome如何将单个标签隔离到单独的进程中,同时看起来像单个应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆