How to intercept Skia draw commands from Chromium Browser
Asked Answered
P

1

6

This is an experimental project of mine related to remote browser isolation. I'm trying to intercept Skia draw commands in a running Chromium instance and later replay them in a different browser instance at client-side via CanvasKit, a WebAssembly build of Skia.

However, I'm having a hard time figuring out where and how to intercept those draw commands within Chromium source code. Any advice on how to approach my problem is much appreciated!

Phototelegraphy answered 19/2, 2020 at 5:19 Comment(0)
S
3

In Chromium, all the draw operations will be recorded in a DisplayItemList which you can find in the definition of class GraphicsContext in blink module. Second, these recorded operations will be replayed later when the CC thinks it will be right time.

On blink's end, all the things above related code was scattered mostly in blink/renderer/platform/graphics/graphics_context.cc and its related files. But if you see all Chromium as a whole, all the graphics things were triggered by CC (Chrome Compositor) which maintain a state machine and runs a draw frame loops triggered by system's vsync signal in Android. On this loop start, blink ends draw recording operations will be pushed. At the end of this loop, the composited frame's image will be translated to a serial of GPU ops and calling the system's GPU devices related APIs to do them. The CC related code files can be found in components/viz/. You should read code of class Display as a starting key point.

My opinion comes from version 68 and you know code in Chromium changes frequently. So I cannot confirm the files and locations are still correct.

Stylet answered 26/7, 2021 at 1:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.