blob: 0dc10fe421d5ca7fc045b3b11140e307830e8103 [file] [log] [blame] [view]
Rakina Zata Amni07b0ce5d2023-06-01 05:15:151# What is content/browser/renderer_host?
2
3This directory contains code that can be loosely categorized as "handling the
4renderer," covering a wide range of topics (navigation, compositing, input,
5etc). Many of the classes represent a browser-side version of a renderer
6concept (e.g., RenderFrameHostImpl is the browser-side equivalent of
7RenderFrameImpl). Refer to the class-level comments on how each class relates
8to or interacts with the renderer.
9
10Note that many of the key classes here are defined in `content/public` and
11exposed to `//content` embedders, with implementations living in
12`content/browser/renderer_host`.
13
14## Rough Categories
15
16A non-exhaustive list of rough categories and descriptions for the code within
17`renderer_host` is below. When adding something that falls into the
18miscellaneous category, consider if it belongs in a separate directory, either
19under `content/browser/` or under `content/browser/renderer_host`.
20
21### Browser-side representation of documents and frame-tree-related renderer-side objects
22Allows the browser-side code to represent document and frame-tree related
23concepts, and communicate with the renderer-side.
24
25Some important classes include:
26- **FrameTree** and **FrameTreeNode**: Represents the frames in the frame tree
27of a page.
28- **RenderFrameHost**: Roughly represents a document within a frame, although
29it does not (yet) change for every new document.
30- **RenderFrameProxyHost**: A placeholder for a frame in other
31SiteInstanceGroups and renderer processes.
32- **RenderViewHost**: Represents a page within a given SiteInstanceGroup.
33- **RenderWidgetHost**: A group of contiguous same-SiteInstanceGroup frames
34that can paint or handle input events as a single unit.
35
36For diagrams and explanations of how those classes fit with each other, see also
37[this documentation](https://www.chromium.org/developers/design-documents/oop-iframes/)
Alex Moshchukdd260a2e2024-02-08 19:04:2538and [docs/frame_trees.md](https://chromium.googlesource.com/chromium/src/+/main/docs/frame_trees.md).
Rakina Zata Amni07b0ce5d2023-06-01 05:15:1539
40### Connections between browser and renderer/GPU processes, process-related code
41Represents child processes (e.g., renderers, GPU, etc) and their connection to
42the browser process.
43
44An important class in this category is **RenderProcessHost**, which represents
45the browser side of the browser <-> renderer communication channel. There will
46be one RenderProcessHost per renderer process.
47
48### Navigation
49Navigation handling code, coordinating the browser & renderer from navigation
50start to finish. Also keeps track of the session history entries created by the
51committed navigations.
52
53Some important classes include:
54- **NavigationRequest**: Represents a navigation attempt, and tracks information
55related to it.
56- **NavigationController**: Manages the joint session history for a frame tree.
57- **NavigationEntry** and **FrameNavigationEntry**: Represents joint session
58history items (for pages), made up of a tree of session history items (for
59frames).
60
Alex Moshchukdd260a2e2024-02-08 19:04:2561See also [docs/navigation.md](https://chromium.googlesource.com/chromium/src/+/main/docs/navigation.md)
62and [docs/session_history.md](https://chromium.googlesource.com/chromium/src/+/main/docs/session_history.md).
Rakina Zata Amni07b0ce5d2023-06-01 05:15:1563
64### Compositing, input, display
65Coordinates handling of input, display, and compositing between the browser,
66renderer, and GPU processes.
67
68Some important classes include:
69- **RenderWidgetHostView\***: The browser owned object that mediates the
70blink::VisualProperties to be used by an embedded Renderer.
71- **DelegatedFrameHost**: Used by RenderWidgetHostView to control which
72viz::Surface of an embedded Renderer the GPU process will display
73EmbeddedFrameSinkImpl: The browser owned object that mediates between an
74embedded Renderer and the GPU process. Allowing for the creation of
75Renderer-GPU Mojo connections.
76- **viz::HostFrameSinkManager**: The browser owned object, accessed via
77GetHostFrameSinkManager, that controls the Browser-GPU Mojo connection. Used to
78establish future connections for Renderers, as well as to control what
79viz::Surfaces to display.
80
81### Misc features that heavily interact with the renderer
82Examples: loading/networking, file/storage, plugins, UI, fonts, media,
83accessibility.
84
85## Layering restriction with WebContents
86Code in this directory can't call up to the WebContents "layer," except through
87delegate interfaces (e.g. RenderFrameHostDelegate). This is to separate out
88code that deals with the renderer process and code that deals with the tab.
Alex Moshchukdd260a2e2024-02-08 19:04:2589This is enforced by the [DEPS](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/DEPS).