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

Unified Diff: content/browser/media/android/video_surface_manager_impl.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/video_surface_manager_impl.cc
diff --git a/content/browser/media/android/video_surface_manager_impl.cc b/content/browser/media/android/video_surface_manager_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..355c0d02c802b4c63bf10dd881c2837d29df1e98
--- /dev/null
+++ b/content/browser/media/android/video_surface_manager_impl.cc
@@ -0,0 +1,67 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/media/android/video_surface_manager_impl.h"
+
+#include "content/browser/android/content_video_view.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/public/browser/web_contents_delegate.h"
+
+namespace content {
+
+static base::LazyInstance<VideoSurfaceManagerImpl>::Leaky g_surface_manager =
+ LAZY_INSTANCE_INITIALIZER;
+
+// static
+VideoSurfaceManager* VideoSurfaceManager::GetInstance() {
+ return VideoSurfaceManagerImpl::GetInstance();
+}
+
+// static
+VideoSurfaceManagerImpl* VideoSurfaceManagerImpl::GetInstance() {
+ return g_surface_manager.Pointer();
+}
+
+VideoSurfaceManagerImpl::VideoSurfaceManagerImpl() {}
+
+VideoSurfaceManagerImpl::~VideoSurfaceManagerImpl() {}
+
+void VideoSurfaceManagerImpl::SetOverrideVideoSurfaceProvider(
+ VideoSurfaceProvider* provider) {
+ // Make sure current provider isn't already set (it shouldn't be because
+ // entering vr (which would set an override) requires pausing chrome (which
+ // should exit fullscreen and remove any existing cvv instances).
+ // TODO(amp): Handle switching surface providers when/if VR changes to not
+ // exit full screen on transition.
+
+ // I have no idea if this is an appropriate way to handle pointers params.
+ current_provider_.reset(provider);
+}
+
+void VideoSurfaceManagerImpl::RemoveOverrideVideoSurfaceProvider(
+ VideoSurfaceProvider* provider) {
+ // Make sure the current provider is actually the passed in provider
+ current_provider_.reset();
+}
+
+VideoSurfaceProvider* VideoSurfaceManagerImpl::GetVideoSurfaceProvider(
+ WebContents* web_contents) {
+
+ if (!current_provider_) {
+ // If we don't own the fullscreen view, but one exists, it means another
+ // WebContents has it. Ignore the request and return a null surface
+ // provider.
+ if (ContentVideoView::GetInstance()) {
+ return nullptr;
+ }
+
+ ContentViewCore* cvc = ContentViewCore::FromWebContents(web_contents);
+ current_provider_.reset(new ContentVideoView(
+ cvc, web_contents->GetDelegate()->GetContentVideoViewEmbedder()));
+ }
+ // Also for returning pointers, is this ok, or should it be something else?
+ return current_provider_.get();
+}
+
+} // namespace content
« no previous file with comments | « content/browser/media/android/video_surface_manager_impl.h ('k') | content/public/browser/android/video_surface_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698