| OLD | NEW |
| 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/child_process_launcher_android.h" | 9 #include "content/browser/android/child_process_launcher_android.h" |
| 10 #include "content/browser/android/content_view_core_impl.h" | 10 #include "content/browser/android/content_view_core_impl.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // If we don't own the fullscreen view, but one exists, it means another | 78 // 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. | 79 // WebContents has it. Ignore this request and return a null surface id. |
| 80 if (ContentVideoView::GetInstance()) { | 80 if (ContentVideoView::GetInstance()) { |
| 81 SendSurfaceID(media::SurfaceManager::kNoSurfaceID); | 81 SendSurfaceID(media::SurfaceManager::kNoSurfaceID); |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 | 84 |
| 85 ContentViewCore* cvc = ContentViewCore::FromWebContents( | 85 ContentViewCore* cvc = ContentViewCore::FromWebContents( |
| 86 WebContents::FromRenderFrameHost(render_frame_host_)); | 86 WebContents::FromRenderFrameHost(render_frame_host_)); |
| 87 content_video_view_.reset(new ContentVideoView(this, cvc)); | 87 content_video_view_.reset( |
| 88 OnNaturalSizeChanged(video_natural_size); | 88 new ContentVideoView(this, cvc, video_natural_size)); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void BrowserSurfaceViewManager::OnNaturalSizeChanged(const gfx::Size& size) { | 91 void BrowserSurfaceViewManager::OnNaturalSizeChanged(const gfx::Size& size) { |
| 92 if (content_video_view_) | 92 if (content_video_view_) |
| 93 content_video_view_->OnVideoSizeChanged(size.width(), size.height()); | 93 content_video_view_->OnVideoSizeChanged(size.width(), size.height()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool BrowserSurfaceViewManager::SendSurfaceID(int surface_id) { | 96 bool BrowserSurfaceViewManager::SendSurfaceID(int surface_id) { |
| 97 return render_frame_host_->Send( | 97 return render_frame_host_->Send( |
| 98 new SurfaceViewManagerMsg_FullscreenSurfaceCreated( | 98 new SurfaceViewManagerMsg_FullscreenSurfaceCreated( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 113 BrowserThread::IO, FROM_HERE, | 113 BrowserThread::IO, FROM_HERE, |
| 114 base::Bind(&SendDestroyingVideoSurfaceOnIO, surface_id, | 114 base::Bind(&SendDestroyingVideoSurfaceOnIO, surface_id, |
| 115 base::Bind(&base::WaitableEvent::Signal, | 115 base::Bind(&base::WaitableEvent::Signal, |
| 116 base::Unretained(&waiter))))) { | 116 base::Unretained(&waiter))))) { |
| 117 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 117 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 118 waiter.Wait(); | 118 waiter.Wait(); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace content | 122 } // namespace content |
| OLD | NEW |