New issue
Advanced search Search tips

Issue 876103 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 2
Type: Bug



Sign in to add a comment

TabManager should not freeze pages that are considered visible in Blink

Project Member Reported by shaseley@google.com, Aug 20

Issue description

We don't freeze tabs if WebContents::GetVisibility() == Visibility::VISIBLE, but this is not necessarily in sync with page visibility in Blink.

Problem:
In the renderer process, there are 2 IPC messages corresponding to RenderWidgetHostImpl::Was[Shown|Hidden] and WebContents::Was[Shown|Hidden] that set the page visibility. If RenderWidgetHostImpl::Was[Shown|Hidden] is called without the WebContents updating its visibility state, then the visibility states of WebContents and page scheduler will be out-of-sync. Freezing a tab in this state will result in an attempt to freeze a visible page, which is not allowed.

Example:
This can happen during WebContents capture. In WebContentsImpl::IncrementCapturerCount(), RenderWidgetHostView::WasUnOccluded() gets called, which changes the page to visible on the Blink side. However, WebContents::GetVisibility() does not return Visibility::VISIBLE and the page is still eligible for freezing. See https://bugs.chromium.org/p/chromium/issues/detail?id=873214#c4 for repro steps.

Possible solution:
Change WebContents::GetVisibility() so it returns VISIBLE if !GetMainFrame()->GetRenderWidgetHost()->is_hidden(). This is in sync with RenderWidgetHostImpl::Was[Shown|Hidden] and handles the example above, as well as other cases where the render widget host show/hide methods are called without updating WebContents visibility.

Other solutions (capture case only):
  1. Change WebContents::GetVisibility() so it returns VISIBLE for a captured WebContents
  2. Check if the WebContents is being captured in TabManager and not freeze it.

It is not clear if there are cases where this happens besides the capture case above, but it is possible and there could be cases in the future.
 
Cc: shaseley@google.com altimin@chromium.org panicker@chromium.org
Owner: fdoray@chromium.org
Status: Assigned (was: Untriaged)
 Issue 873214  has been merged into this issue.
Project Member

Comment 3 by bugdroid1@chromium.org, Aug 30

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/aec643b68e00139a0b5e63d3abadb69551b761bf

commit aec643b68e00139a0b5e63d3abadb69551b761bf
Author: Francois Doray <fdoray@chromium.org>
Date: Thu Aug 30 19:35:42 2018

aura: Make WebContents VISIBLE when shown in Alt-Tab view on ChromeOS.

Today, WebContents::GetVisibility() returns HIDDEN for a tab that is in
a minimized window shown in the Alt-Tab view on ChromeOS. This is
because content::WebContents::GetVisibility() indicates the visibility
of the aura::Window, and isn't affected by the mirroring functionnality
used by the Alt-Tab view.

Unfortunately, the fact that WebContents::GetVisibility() returns
HIDDEN makes TabManager think that the tab is eligible for freezing and
discarding (freezing or discarding a tab in Alt-Tab breaks the live
view functionnality). TabManager could check by itself whether the
WebContents IsBeingCaptured(), but instead of requiring that every
call to WebContents::GetVisibility() be accompanied to a check to
IsBeingCaptured(), we believe it's better to return VISIBLE from
GetVisibility() when a tab is displayed in Alt-Tab view.

Bug: 876103
Change-Id: I01c07858bcae3038577bac1408c67eb72fe08e0c
Reviewed-on: https://chromium-review.googlesource.com/1191862
Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587711}
[modify] https://crrev.com/aec643b68e00139a0b5e63d3abadb69551b761bf/content/browser/web_contents/web_contents_view_aura.cc
[modify] https://crrev.com/aec643b68e00139a0b5e63d3abadb69551b761bf/content/browser/web_contents/web_contents_view_aura.h
[modify] https://crrev.com/aec643b68e00139a0b5e63d3abadb69551b761bf/content/browser/web_contents/web_contents_view_aura_unittest.cc

Sign in to add a comment