Android WebView
Chrome Graphics Meetup
boliu@ April 2019
android.webkit.WebView
A View in Android SDK to display web contents
Hundreds of APIs
Sixth platform
Blink’s intent-to-implement / intent-to-ship template
Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes or no. If no, explain why this feature is not supported on these platforms.
Primary use cases
Embedded into app
Browsers
Cordova
Ads
Screenshot missing intentionally
WebView or not?
Add Google account on Android
Gmail email compose
Clicking on a link in Gmail
Clicking on a link in Facebook app
WebView or not?
Add Google account on Android
Gmail email compose
Clicking on a link in Gmail
Clicking on a link in Facebook app
WebView’s user base is probably on-par with Chrome on Android
Development background
Browser process is the app process
Each app is ~equivalent to a different installation of chrome (different data dir)
Each webview is ~equivalent to a tab in chrome
Cannot talk directly to Google services
Source layout
Use OS_ANDROID. No separate compile-time define
Includes src/content and below, but not src/chrome
Rest of diagram fairly out of date ->
android_webview
Release
Identical release as Chrome on Android
Same version pushed to play store at same time. Same version bundled in Android OS system image
Supports the same canary, dev, beta, stable channels
Developer workflow
Historically different (confusing) packaging depending on Android version. Different build targets is confusing
Webview apk only implements webview APIs
On Android N+, workflow almost as easy as Chrome on Android
Supports UMA metric collection and Finch experiments
WebView is an Android View
A layer in Android’s compositor (hwui)
WebView connects chromium’s compositing pieces in different ways to satisfy these requirements
Chrome’s architecture (grossly simplified)
Paint
Raster
Draw
Paint
Raster
Draw
Paint
Raster
Draw
Paint
Raster
Draw
GPU Service
Aggregate
DrawAndSwap
Renderer
Compositors
Embedding
Browser
Compositor
CompositorFrame
WebView: No browser compositor
Paint
Raster
Draw
Paint
Raster
Draw
Paint
Raster
Draw
GPU Service
Aggregate
DrawAndSwap
Renderer
Compositors
Embedding
CompositorFrame
WebView: No embedding support, yet
Paint
Raster
Draw
GPU Service
(Aggregate)
DrawAndSwap
Renderer
Compositor
CompositorFrame
WebView: Two GPU services
Paint
Raster
Draw
GPU Service
(Aggregate)
DrawAndSwap
Renderer
Compositor
CompositorFrame
GPU Service
on hwui render thread
Texture sharing
WebView: Separate viz::Display, conceptually
Paint
Raster
Draw
GPU Service
(Aggregate)
DrawAndSwap
Renderer
Compositor
CompositorFrame
GPU Service
on hwui thread
Texture sharing
Paint
Raster
Draw
(Aggregate)
DrawAndSwap
WebView: SynchronousCompositor
Paint
Raster
Draw
GPU Service
(Aggregate)
DrawAndSwap
Renderer
Compositor
CompositorFrame
GPU Service
on hwui thread
Texture sharing
Other rendering differences
Please remember WebView for your features :)