Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: content/renderer/media/android/renderer_media_player_manager.cc

Issue 136113015: Fix fullscreen video race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address raised issues Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/android/renderer_media_player_manager.cc
diff --git a/content/renderer/media/android/renderer_media_player_manager.cc b/content/renderer/media/android/renderer_media_player_manager.cc
index 6969511946544753df6229b653dbd617b63b2766..8d3a069f31e49197806dc95c708c7f1624905835 100644
--- a/content/renderer/media/android/renderer_media_player_manager.cc
+++ b/content/renderer/media/android/renderer_media_player_manager.cc
@@ -24,7 +24,8 @@ namespace content {
RendererMediaPlayerManager::RendererMediaPlayerManager(RenderView* render_view)
: RenderViewObserver(render_view),
next_media_player_id_(0),
- fullscreen_frame_(NULL) {}
+ fullscreen_frame_(NULL),
+ pending_fullscreen_frame_(NULL) {}
RendererMediaPlayerManager::~RendererMediaPlayerManager() {
std::map<int, WebMediaPlayerAndroid*>::iterator player_it;
@@ -223,11 +224,14 @@ void RendererMediaPlayerManager::OnRequestFullscreen(int player_id) {
player->OnRequestFullscreen();
}
-void RendererMediaPlayerManager::EnterFullscreen(int player_id) {
+void RendererMediaPlayerManager::EnterFullscreen(int player_id,
+ blink::WebFrame* frame) {
+ pending_fullscreen_frame_ = frame;
Send(new MediaPlayerHostMsg_EnterFullscreen(routing_id(), player_id));
}
void RendererMediaPlayerManager::ExitFullscreen(int player_id) {
+ pending_fullscreen_frame_ = NULL;
Send(new MediaPlayerHostMsg_ExitFullscreen(routing_id(), player_id));
}
@@ -381,10 +385,12 @@ ProxyMediaKeys* RendererMediaPlayerManager::GetMediaKeys(int media_keys_id) {
}
bool RendererMediaPlayerManager::CanEnterFullscreen(blink::WebFrame* frame) {
- return !fullscreen_frame_ || IsInFullscreen(frame);
+ return (!fullscreen_frame_ && !pending_fullscreen_frame_)
+ || ShouldEnterFullscreen(frame);
}
void RendererMediaPlayerManager::DidEnterFullscreen(blink::WebFrame* frame) {
+ pending_fullscreen_frame_ = NULL;
fullscreen_frame_ = frame;
}
@@ -396,6 +402,10 @@ bool RendererMediaPlayerManager::IsInFullscreen(blink::WebFrame* frame) {
return fullscreen_frame_ == frame;
}
+bool RendererMediaPlayerManager::ShouldEnterFullscreen(blink::WebFrame* frame) {
+ return fullscreen_frame_ == frame || pending_fullscreen_frame_ == frame;
+}
+
#if defined(VIDEO_HOLE)
void RendererMediaPlayerManager::RequestExternalSurface(
int player_id,

Powered by Google App Engine
This is Rietveld 408576698