Don't SetVisible on swapped out RenderWidgets, and drop gpu resources.
When a RenderWidget is created for a RenderViewImpl, it may be considered "swapped out". This means the main frame for this RenderView's frame tree is not local, the RenderView exists to hold some other local subframe, which will be composited and have a RenderWidget. Thus the RenderWidget attached to the RenderViewImpl is not actually used, there is no output from the remote main frame in this tree. I like to refer to these swapped out RenderWidgets as zombies. During navigations, a RenderViewImpl's main frame may change to or from being local, in which case the RenderWidget attached to it changes to or from being a zombie. When becoming a zombie, the WebFrameWidget attached to the RenderViewImpl (wrapping the WebViewImpl) is destroyed, and this marks the compositor as SetVisible(false) on the RenderWidget (via the WebViewImpl). When becoming alive again, a new WebFrameWidget is attached to the RenderViewImpl, and the WebFrameWidget marks the compositor as SetVisible(true) on the RenderWidget (via the WebViewImpl). While a zombie, the WebViewImpl is also told not to allow any visibility changes to be passed along to the RenderWidget. This is because as the local subframe becomes visible with the Page, we'd tell the WebView about this, to tell the Page. But since the WebView now has a zombie RenderWidget, it shouldn't also tell that. Note when the RenderViewImpl is created and initially swapped out it creates a RenderWidget but nothing tells its compositor about the zombie state of affairs, so it becomes visible, which makes it acquire a Gpu channel and start its scheduler etc. Woops. This CL rearranges things a bit. - A new RenderWidget does not SetVisible(true) if swapped out. - RenderViewImpl directly marks it SetVisible(false) when removing the WebFrameWidget. - RenderViewImpl *also* removes the LayerTreeFrameSink to drop the Gpu channel since we don't need to be fast at becoming visible (the RenderWidget is a zombie!) - RenderViewImpl directly marks it as SetVisible(true) when getting a new WebFrameWidget as the RenderWidget stops being a zombie. - WebViewImpl stops calling SetVisible on the RenderWidget when its main frame is not visible. In the future the RenderWidget should be a member of the main LocalFrame, and thus won't even exist when the main frame is not local. R=dcheng@chromium.org, piman@chromium.org Change-Id: I87a5d0dfeaaf08cb91c9348b26b4205db55b3a81 Bug: 894899, 419087 Reviewed-on: https://chromium-review.googlesource.com/c/1290140Reviewed-by:Daniel Cheng <dcheng@chromium.org> Reviewed-by:
Antoine Labour <piman@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/master@{#602389}
Showing
Please register or sign in to comment