Relanding https://codereview.chromium.org/
564553002/ with fixes for the unit test failures which required addition of some more plumbing in the form of dummy IO and file blocking threads. The IO thread is needed to ensure that the RenderWidgetHelper instances get freed corectly.
When we switch tabs in chrome, the tab being switched away from gets hidden/shown/hidden.
This occurs in the NativeViewHostAura::NativeViewDetaching code path where we first remove the
clipping window which is the intermediate parent of the web contents view. The clipping window
is hidden which causes the RWHVA::Hide function to get called which initiates the hiding sequence.
Then the web contents view is reparented to the main view which is still visible. Now the RWHVA::Show
function is called which initiates the show sequence. Eventually the main view is hidden, which then
initiates the hide sequence.
Addressed this with the following changes.
1. WebView::AttachWebContents and WebView::DetachWebContents
now show and hide the webcontents native view. The
WebContents is shown and hidden as before in
WebContentsNativeViewAura::OnWindowVisibilityChanged.
2. Removed the WebContentsNativeViewAura::OnWindowParentChanged function.
This function was present to show and hide the webcontents if the window was visible.
This should not be needed with the change in #1 above.
3. Added a new file webview_unittest.cc. This contains the unittest WebViewUnitTest.TestWebViewAttachDetachWebContents
This is run as part of unit_tests.exe.
BUG=412989
R=sky
Review URL: https://codereview.chromium.org/
569153005
Cr-Commit-Position: refs/heads/master@{#295151}