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

Side by Side Diff: content/browser/media/android/browser_surface_view_manager.cc

Issue 2643893002: Skip video overlay surface management when in VR. (Closed)
Patch Set: Removed public API changes and changed references to cast to base instead. 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/media/android/browser_surface_view_manager.h" 5 #include "content/browser/media/android/browser_surface_view_manager.h"
6 6
7 #include "base/android/build_info.h" 7 #include "base/android/build_info.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "content/browser/android/content_view_core_impl.h" 9 #include "content/browser/android/content_view_core_impl.h"
10 #include "content/browser/gpu/gpu_process_host.h" 10 #include "content/browser/gpu/gpu_process_host.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 } 57 }
58 58
59 void BrowserSurfaceViewManager::DidExitFullscreen(bool release_media_player) { 59 void BrowserSurfaceViewManager::DidExitFullscreen(bool release_media_player) {
60 DVLOG(3) << __func__; 60 DVLOG(3) << __func__;
61 content_video_view_.reset(); 61 content_video_view_.reset();
62 } 62 }
63 63
64 void BrowserSurfaceViewManager::OnCreateFullscreenSurface( 64 void BrowserSurfaceViewManager::OnCreateFullscreenSurface(
65 const gfx::Size& video_natural_size) { 65 const gfx::Size& video_natural_size) {
66 // If we are in virtual reality, no surface view is needed so just return.
67 // TODO(http://crbug.com/673886): Support overlay surfaces in VR using GVR
68 // reprojection video surface.
69 RenderWidgetHostViewBase * rwhvb =
70 static_cast<RenderWidgetHostViewBase*>(render_frame_host_->GetView());
71 if (rwhvb->IsInVR()) {
72 SendSurfaceID(media::SurfaceManager::kNoSurfaceID);
73 return;
74 }
75
66 // It's valid to get this call if we already own the fullscreen view. We just 76 // It's valid to get this call if we already own the fullscreen view. We just
67 // return the existing surface id. 77 // return the existing surface id.
68 if (content_video_view_) { 78 if (content_video_view_) {
69 // Send the surface now if we have it. Otherwise it will be returned by 79 // Send the surface now if we have it. Otherwise it will be returned by
70 // |SetVideoSurface|. 80 // |SetVideoSurface|.
71 if (surface_id_ != media::SurfaceManager::kNoSurfaceID) { 81 if (surface_id_ != media::SurfaceManager::kNoSurfaceID) {
72 SendSurfaceID(surface_id_); 82 SendSurfaceID(surface_id_);
73 OnNaturalSizeChanged(video_natural_size); 83 OnNaturalSizeChanged(video_natural_size);
74 return; 84 return;
75 } 85 }
76 } 86 }
77 87
78 // If we don't own the fullscreen view, but one exists, it means another 88 // If we don't own the fullscreen view, but one exists, it means another
79 // WebContents has it. Ignore this request and return a null surface id. 89 // WebContents has it. Ignore this request and return a null surface id.
80 if (ContentVideoView::GetInstance()) { 90 if (ContentVideoView::GetInstance()) {
81 SendSurfaceID(media::SurfaceManager::kNoSurfaceID); 91 SendSurfaceID(media::SurfaceManager::kNoSurfaceID);
82 return; 92 return;
83 } 93 }
84 94
85 WebContents* web_contents = 95 WebContents* web_contents =
86 WebContents::FromRenderFrameHost(render_frame_host_); 96 WebContents::FromRenderFrameHost(render_frame_host_);
87 if (!web_contents->GetDelegate()) 97 if (!web_contents->GetDelegate()) {
98 SendSurfaceID(media::SurfaceManager::kNoSurfaceID);
88 return; 99 return;
100 }
89 ContentViewCore* cvc = ContentViewCore::FromWebContents(web_contents); 101 ContentViewCore* cvc = ContentViewCore::FromWebContents(web_contents);
90 content_video_view_.reset( 102 content_video_view_.reset(
91 new ContentVideoView(this, cvc, 103 new ContentVideoView(this, cvc,
92 web_contents->GetDelegate()->GetContentVideoViewEmbedder(), 104 web_contents->GetDelegate()->GetContentVideoViewEmbedder(),
93 video_natural_size)); 105 video_natural_size));
94 } 106 }
95 107
96 void BrowserSurfaceViewManager::OnNaturalSizeChanged(const gfx::Size& size) { 108 void BrowserSurfaceViewManager::OnNaturalSizeChanged(const gfx::Size& size) {
97 if (content_video_view_) 109 if (content_video_view_)
98 content_video_view_->OnVideoSizeChanged(size.width(), size.height()); 110 content_video_view_->OnVideoSizeChanged(size.width(), size.height());
(...skipping 13 matching lines...) Expand all
112 BrowserThread::IO, FROM_HERE, 124 BrowserThread::IO, FROM_HERE,
113 base::Bind(&SendDestroyingVideoSurfaceOnIO, surface_id, 125 base::Bind(&SendDestroyingVideoSurfaceOnIO, surface_id,
114 base::Bind(&base::WaitableEvent::Signal, 126 base::Bind(&base::WaitableEvent::Signal,
115 base::Unretained(&waiter))))) { 127 base::Unretained(&waiter))))) {
116 base::ThreadRestrictions::ScopedAllowWait allow_wait; 128 base::ThreadRestrictions::ScopedAllowWait allow_wait;
117 waiter.Wait(); 129 waiter.Wait();
118 } 130 }
119 } 131 }
120 132
121 } // namespace content 133 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698