Commit e082f93d authored by Arthur Hemery's avatar Arthur Hemery Committed by Commit Bot

[bfcache] Disable BackForwardCache for pages with media players.

This patch prevents the BackForwardCache from caching pages that want to
play media.

My understanding is that MediaWebContentsObserver has an indexed map of
RenderFrameHost to MediaSessionController via its delegate member
MediaSessionControllerManager.

These get added in MediaWebContentsObserver::OnMediaPlaying and sometimes
removed by observing WebContents::RenderFrameHostDeleted.

With the BackForwardCache we do not get this last event and are left in
a non-valid state, so we proactively disable caching for pages involved
with media.

More details on why we sometimes need to disable bfcache:
https://docs.google.com/document/d/1NjZeusdS1kyEkZyfLggndU1A6qVt0Y1sa-LRUxnMoK8

Change-Id: Ibaa3040c9118a8a8dc5f1ad0f0f8d2dbd4609cd7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1832208
Commit-Queue: Arthur Hemery <ahemery@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704165}
parent b0cd2470
...@@ -220,6 +220,9 @@ void MediaWebContentsObserver::OnMediaPlaying( ...@@ -220,6 +220,9 @@ void MediaWebContentsObserver::OnMediaPlaying(
if (is_remote) if (is_remote)
return; return;
BackForwardCache::DisableForRenderFrameHost(
render_frame_host, "MediaWebContentsObserver::OnMediaPlaying");
const MediaPlayerId id(render_frame_host, delegate_id); const MediaPlayerId id(render_frame_host, delegate_id);
if (has_audio) if (has_audio)
AddMediaPlayerEntry(id, &active_audio_players_); AddMediaPlayerEntry(id, &active_audio_players_);
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
-org.chromium.chrome.browser.infobar.InfoBarTest.testInfoBarForGeolocationDisappearsOnBack -org.chromium.chrome.browser.infobar.InfoBarTest.testInfoBarForGeolocationDisappearsOnBack
-org.chromium.chrome.browser.keyboard_accessory.PasswordGenerationIntegrationTest.testAutomaticGenerationUsePassword -org.chromium.chrome.browser.keyboard_accessory.PasswordGenerationIntegrationTest.testAutomaticGenerationUsePassword
-org.chromium.chrome.browser.keyboard_accessory.PasswordGenerationIntegrationTest.testManualGenerationUsePassword -org.chromium.chrome.browser.keyboard_accessory.PasswordGenerationIntegrationTest.testManualGenerationUsePassword
-org.chromium.chrome.browser.media.*
-org.chromium.chrome.browser.notifications.NotificationPlatformBridgeIntentTest.testLaunchNotificationPreferencesForCategory -org.chromium.chrome.browser.notifications.NotificationPlatformBridgeIntentTest.testLaunchNotificationPreferencesForCategory
-org.chromium.chrome.browser.notifications.NotificationPlatformBridgeIntentTest.testLaunchNotificationPreferencesForWebsite -org.chromium.chrome.browser.notifications.NotificationPlatformBridgeIntentTest.testLaunchNotificationPreferencesForWebsite
-org.chromium.chrome.browser.offlinepages.* -org.chromium.chrome.browser.offlinepages.*
......
...@@ -95,17 +95,13 @@ ...@@ -95,17 +95,13 @@
# Failing on android only, need to be triaged, see https://crbug.com/1006267. # Failing on android only, need to be triaged, see https://crbug.com/1006267.
-BackForwardCacheMetricsBrowserTest.Fetch -BackForwardCacheMetricsBrowserTest.Fetch
-BackForwardCacheMetricsBrowserTest.XHR -BackForwardCacheMetricsBrowserTest.XHR
-WebContentsSplitCacheBrowserTestEnabled.SplitCache*
-WebRtcBrowserTest.CanSetupH264VideoCallOnSupportedDevice -WebRtcBrowserTest.CanSetupH264VideoCallOnSupportedDevice
-WithoutCORBProtectionSniffing/CrossSiteDocumentBlockingTest.* -WithoutCORBProtectionSniffing/CrossSiteDocumentBlockingTest.*
-WithCORBProtectionSniffing/CrossSiteDocumentBlockingTest.* -WithCORBProtectionSniffing/CrossSiteDocumentBlockingTest.*
# Flaky on android only, need to be triaged, see https://crbug.com/1006267. # Flaky on android only, need to be triaged, see https://crbug.com/1006267.
-IndexedDBBrowserTest* -IndexedDBBrowserTest*
-MediaCanPlayTypeTest.*
-MediaSessionImplBrowserTest.*
-MediaSessionImplParamBrowserTest.*
-MediaSourceTest.*
-MidiBrowserTest.*
-MHTMLGenerationTest/MHTMLGenerationTest.* -MHTMLGenerationTest/MHTMLGenerationTest.*
-MSE_ClearKey/EncryptedMediaTest.* -MSE_ClearKey/EncryptedMediaTest.*
-MSE_ExternalClearKey/EncryptedMediaTest.* -MSE_ExternalClearKey/EncryptedMediaTest.*
......
...@@ -49,10 +49,5 @@ ...@@ -49,10 +49,5 @@
-GeolocationServiceTest.* -GeolocationServiceTest.*
-MediaInternalsAudioLogTest/MediaInternalsAudioLogTest.* -MediaInternalsAudioLogTest/MediaInternalsAudioLogTest.*
-MediaInternalsVideoCaptureDeviceTest.NotifyVideoCaptureDeviceCapabilitiesEnumerated -MediaInternalsVideoCaptureDeviceTest.NotifyVideoCaptureDeviceCapabilitiesEnumerated
-MediaSessionControllerTest.*
-MediaSessionEnabledTestInstances/MediaSessionControllersManagerTest.*
-MediaSessionImplServiceRoutingTest.*
-MediaSessionImplTest.*
-MediaSessionImplUmaTest.*
-MediaStreamManagerTest.* -MediaStreamManagerTest.*
-RenderFrameAudioOutputStreamFactoryTest.* -RenderFrameAudioOutputStreamFactoryTest.*
...@@ -19,6 +19,5 @@ ...@@ -19,6 +19,5 @@
-CreditCardAccessoryControllerTest.ServerCardUnmask -CreditCardAccessoryControllerTest.ServerCardUnmask
# Other failures # Other failures
-MediaDrmOriginIdManagerTest.NetworkChangeFails
-OfflinePageUtilsTest.* -OfflinePageUtilsTest.*
-PreviewsUKMObserverTest.TestPageEndReasonUMA -PreviewsUKMObserverTest.TestPageEndReasonUMA
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