Commit cf3bc8ef authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

Video capture forces render frame creation.

Previous to this, a page would have to be unoccluded and visible in
order to create a new renderer, though the presence of a video capturer
would prevent the page from being unloaded.

This allows hover cards and the new touch tabstrip to cause tabs restored
when the browser reloads to render. Previously, some tabs would never
render until the user actually selected them.

Failure to generate thumbnails after browser restore was one of the
biggest complaints about hover cards in the user study that was done
earlier this year.

Bug: 1020782
Change-Id: I06a23c39ade22e15bef60798faca9fd4cdae53ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1908060Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Dana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715025}
parent 1f68b6b7
...@@ -2563,9 +2563,6 @@ void WebContentsImpl::FullscreenFrameSetUpdated() { ...@@ -2563,9 +2563,6 @@ void WebContentsImpl::FullscreenFrameSetUpdated() {
void WebContentsImpl::UpdateVisibilityAndNotifyPageAndView( void WebContentsImpl::UpdateVisibilityAndNotifyPageAndView(
Visibility new_visibility) { Visibility new_visibility) {
if (new_visibility == Visibility::VISIBLE)
controller_.SetActive(true);
// Only hide the page if there are no entities capturing screenshots // Only hide the page if there are no entities capturing screenshots
// or video (e.g. mirroring). // or video (e.g. mirroring).
const bool page_is_visible = const bool page_is_visible =
...@@ -2574,12 +2571,26 @@ void WebContentsImpl::UpdateVisibilityAndNotifyPageAndView( ...@@ -2574,12 +2571,26 @@ void WebContentsImpl::UpdateVisibilityAndNotifyPageAndView(
// the "disable rendering" optimization. // the "disable rendering" optimization.
const bool view_is_visible = page_is_visible || HasPictureInPictureVideo(); const bool view_is_visible = page_is_visible || HasPictureInPictureVideo();
// This shows the Page before showing the individual RenderWidgets, as
// RenderWidgets will work to produce compositor frames and handle input
// as soon as they are shown. But the Page and other classes do not expect to
// be producing frames when the Page is hidden. So we make sure the Page is
// shown first.
if (page_is_visible) { if (page_is_visible) {
// We cannot show a page or capture video unless there is a valid renderer
// associated with this web contents. The navigation controller for this
// page must be set to active (allowing navigation to complete, a renderer
// and its associated views to be created, etc.) if any of these conditions
// holds.
//
// Previously, it was possible for browser-side code to try to capture video
// from a restored tab (for a variety of reasons, including the browser
// creating preview thumbnails) and the tab would never actually load. By
// keying this behavior off of |page_is_visible| instead of just
// |new_visibility| we avoid this case. See crbug.com/1020782 for more
// context.
controller_.SetActive(true);
// This shows the Page before showing the individual RenderWidgets, as
// RenderWidgets will work to produce compositor frames and handle input
// as soon as they are shown. But the Page and other classes do not expect
// to be producing frames when the Page is hidden. So we make sure the Page
// is shown first.
SendPageMessage(new PageMsg_VisibilityChanged( SendPageMessage(new PageMsg_VisibilityChanged(
MSG_ROUTING_NONE, PageVisibilityState::kVisible)); MSG_ROUTING_NONE, PageVisibilityState::kVisible));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment