This folder holds WebView's renderer-specific code.
Like with other content embedders,
//android_webview/renderer/ can depend on
//android_webview/common/ but not
//android_webview/browser/. It can also depend on content layer (and lower layers) as other embedders would (ex. can depend on
On Lollipop (API 21) through Nougat MR1 (API 25) WebView has only a single renderer, which runs in the browser process (so there's no sandboxing). The renderer runs on a separate thread, which we would call the “renderer thread.”
Starting in Oreo (API 26) WebView has a single out-of-process renderer (we sometimes refer to this as “multiprocess mode”). This is enabled for high-memory devices (low-memory devices still use an in-process renderer as before).
The out-of-process renderer is enabled by a new Android API (
android:externalService), to create sandboxed processes which run in the embedding app's context rather than the WebView provider's context.
Without this API, we could only declare a fixed number of renderer processes to run in the WebView provider‘s context, and WebView (running in the app’s process) would have to pick one of these declared services to use as the renderer process. This would be a security problem because:
Running renderers in the app's context ensures content from two apps are always isolated, aligning with the Android security model.
Starting with Oreo, Android apps have the opportunity to recover from renderer crashes by overriding
WebViewClient#onRenderProcessGone(). However, for backwards compatibility, WebView crashes the browser process if the app has not overridden this callback. Therefore, unlike in Chrome, renderer crashes are often non-recoverable.
WebView does not support multiple renderer processes, but this may be supported in the future.