browser
进程是操作系统分配资源的基本单位,拥有独立的内存空间,
而线程是进程中的执行单元,多个线程共享同一进程的资源。
Process
- the
browser process
acts as the main controller in the browser architecture. It is the central process that coordinates and manages other processes such as the renderer process, network process, GPU process, plugin process, and extension process.
- Each tab has an independent
renderer process
responsible for rendering and executing tasks related to that tab.
- Other processes (like browser, GPU, network, etc.) are shared globally across tabs.

https://developer.chrome.com/blog/inside-browser-part1
Thread
The
JavaScript engine corresponds to the main thread
in the renderer process.
+--------------------------+ +-------------------+
| Renderer Process | <-------> | GPU Process | <--- Handles graphics rendering
+--------------------------+ +-------------------+
| +--------------------+ |
| | Main Thread | | <--- Executes JavaScript and handles the event loop
| +--------------------+ |
| | Render Thread | | <--- Parses HTML/CSS, builds DOM/CSSOM
| +--------------------+ |
| | Layout Thread | | <--- Calculates layout
| +--------------------+ |
| | Paint Thread | | <--- Renders content to the screen
| +--------------------+ |
+--------------------------+
插件:
特性 | 浏览器插件 | Webpack 插件 | iframe 插件 |
主要用途 | 扩展浏览器功能 | 扩展 Webpack 构建 | 将外部应用嵌入网页 |
运行环境 | 浏览器(background/content script) | Node.js(Webpack 构建时) | 浏览器(沙盒环境) |
代码注入 | 可能(content script) | 否 | 否(受限于沙盒) |
典型应用 | 广告拦截、翻译、ChatGPT 插件 | 代码优化、热更新 | 在线客服、支付插件 |
与其他技术的关联 | 可以注入 iframe | 可以打包插件代码 | 需要与 content script 交互 |