Okay, so like I said in comment 10, we definitely want to force generate a frame for the composite which happens as part of the resume, rather than waiting for the next paint. Calling
WebRenderBridgeParent::Resume() would do so, however, even that is not enough. We do indeed generate a frame, but webrender may decide to skip rendering it because it thinks nothing has changed. What we need is
ScheduleForcedGenerateFrame(), which first sends an invalidate frame message to webrender, before ensuring we generate a new frame, then webrender will decide to definitely render it because of the invalidation message. This also happens to fix bug 1606179.
The next problem is that we now hit a race condition to do with the android surface size. Here is the java callback which fires when we resume.
mCompositor.syncResumeResizeCompositor() synchronously calls the code discussed above which schedules a new frame, however this frame is then built asynchronously and will eventually be rendered on the render thread. The
onWindowBoundsChanged() call on the other hand will asynchronously call in to the widget code to set the new widget size. In the render thread when we go to render the frame, we read the widget size and render the frame at that size. So there is a race condition between the widget size being updated and the frame being rendered. We are more likely to hit this now that we schedule a frame immediately on resume, however the problem was pre-existing.
This race condition was solved in layers by ignoring the widget's size variable, and instead passing the new size from the
CompositorBridgeParent to the
CompositorOGL. In webrender, the data path between
RendererOGL is trickier, so for now it will be easier to use
ANativeWindow_getWidth/Height() to query the size (again, just ignoring the widget's size variable).
As Sotaro pointed out in Slack, long term we won't be able to use
ANativeWindow_getWidth/Height(), as bug 1594860 will make us stop rendering in to an Android
Surface. However, we can cross that bridge when we come to it.