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

Unified Diff: content/browser/media/android/browser_surface_view_manager.cc

Issue 2567233002: Use GVR async reprojection video surface for fullscreen in VR shell
Patch Set: Refactor using new interface and manager, also rebased Created 3 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/browser/media/android/browser_surface_view_manager.cc
diff --git a/content/browser/media/android/browser_surface_view_manager.cc b/content/browser/media/android/browser_surface_view_manager.cc
index 4a73cd2f86c8a0d67a01b0c907fa8157d045dd46..6fc5b0b8478429f57e304c25a8274d22f19a8e48 100644
--- a/content/browser/media/android/browser_surface_view_manager.cc
+++ b/content/browser/media/android/browser_surface_view_manager.cc
@@ -6,7 +6,6 @@
#include "base/android/build_info.h"
#include "base/trace_event/trace_event.h"
-#include "content/browser/android/content_view_core_impl.h"
#include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/media/surface_view_manager_messages_android.h"
@@ -32,7 +31,9 @@ void SendDestroyingVideoSurfaceOnIO(int surface_id,
BrowserSurfaceViewManager::BrowserSurfaceViewManager(
RenderFrameHost* render_frame_host)
: render_frame_host_(render_frame_host),
- surface_id_(media::SurfaceManager::kNoSurfaceID) {}
+ surface_id_(media::SurfaceManager::kNoSurfaceID) {
+ video_surface_manager_ = VideoSurfaceManager::GetInstance();
+}
BrowserSurfaceViewManager::~BrowserSurfaceViewManager() {}
@@ -58,14 +59,15 @@ void BrowserSurfaceViewManager::SetVideoSurface(gl::ScopedJavaSurface surface) {
void BrowserSurfaceViewManager::DidExitFullscreen(bool release_media_player) {
DVLOG(3) << __func__;
- content_video_view_.reset();
+ video_surface_provider_ = nullptr;
}
void BrowserSurfaceViewManager::OnCreateFullscreenSurface(
const gfx::Size& video_natural_size) {
+
// It's valid to get this call if we already own the fullscreen view. We just
// return the existing surface id.
- if (content_video_view_) {
+ if (video_surface_provider_ != nullptr) {
// Send the surface now if we have it. Otherwise it will be returned by
// |SetVideoSurface|.
if (surface_id_ != media::SurfaceManager::kNoSurfaceID) {
@@ -75,27 +77,27 @@ void BrowserSurfaceViewManager::OnCreateFullscreenSurface(
}
}
- // If we don't own the fullscreen view, but one exists, it means another
- // WebContents has it. Ignore this request and return a null surface id.
- if (ContentVideoView::GetInstance()) {
- SendSurfaceID(media::SurfaceManager::kNoSurfaceID);
- return;
- }
-
WebContents* web_contents =
WebContents::FromRenderFrameHost(render_frame_host_);
if (!web_contents->GetDelegate())
return;
- ContentViewCore* cvc = ContentViewCore::FromWebContents(web_contents);
- content_video_view_.reset(
- new ContentVideoView(this, cvc,
- web_contents->GetDelegate()->GetContentVideoViewEmbedder(),
- video_natural_size));
+
+ video_surface_provider_ = video_surface_manager_->GetVideoSurfaceProvider(
+ web_contents);
+ // If we don't own the fullscreen view and we get back null from the surface
+ // manager, assume another WebContents has it. Ignore this request and return
+ // a null surface id.
+ if (video_surface_provider_ == nullptr) {
+ SendSurfaceID(media::SurfaceManager::kNoSurfaceID);
+ return;
+ }
+
+ video_surface_provider_->CreateVideoSurface(this, video_natural_size);
}
void BrowserSurfaceViewManager::OnNaturalSizeChanged(const gfx::Size& size) {
- if (content_video_view_)
- content_video_view_->OnVideoSizeChanged(size.width(), size.height());
+ if (video_surface_provider_ != nullptr)
+ video_surface_provider_->OnVideoSizeChanged(size.width(), size.height());
}
bool BrowserSurfaceViewManager::SendSurfaceID(int surface_id) {

Powered by Google App Engine
This is Rietveld 408576698