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 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 BrowserSurfaceViewManager::BrowserSurfaceViewManager( | 33 BrowserSurfaceViewManager::BrowserSurfaceViewManager( |
34 RenderFrameHost* render_frame_host) | 34 RenderFrameHost* render_frame_host) |
35 : render_frame_host_(render_frame_host), | 35 : render_frame_host_(render_frame_host), |
36 surface_id_(media::SurfaceManager::kNoSurfaceID) {} | 36 surface_id_(media::SurfaceManager::kNoSurfaceID) {} |
37 | 37 |
38 BrowserSurfaceViewManager::~BrowserSurfaceViewManager() {} | 38 BrowserSurfaceViewManager::~BrowserSurfaceViewManager() {} |
39 | 39 |
40 void BrowserSurfaceViewManager::SetVideoSurface( | 40 void BrowserSurfaceViewManager::SetVideoSurface(gl::ScopedJavaSurface surface) { |
41 gfx::ScopedJavaSurface surface) { | |
42 TRACE_EVENT0("media", "BrowserSurfaceViewManager::SetVideoSurface"); | 41 TRACE_EVENT0("media", "BrowserSurfaceViewManager::SetVideoSurface"); |
43 if (surface.IsEmpty()) { | 42 if (surface.IsEmpty()) { |
44 DCHECK_NE(surface_id_, media::SurfaceManager::kNoSurfaceID); | 43 DCHECK_NE(surface_id_, media::SurfaceManager::kNoSurfaceID); |
45 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); | 44 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); |
46 UnregisterViewSurface(surface_id_); | 45 UnregisterViewSurface(surface_id_); |
47 SendDestroyingVideoSurfaceIfRequired(surface_id_); | 46 SendDestroyingVideoSurfaceIfRequired(surface_id_); |
48 surface_id_ = media::SurfaceManager::kNoSurfaceID; | 47 surface_id_ = media::SurfaceManager::kNoSurfaceID; |
49 } else { | 48 } else { |
50 // We mainly use the surface tracker to allocate a surface id for us. The | 49 // We mainly use the surface tracker to allocate a surface id for us. The |
51 // lookup will go through the Android specific path and get the java | 50 // lookup will go through the Android specific path and get the java |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 BrowserThread::IO, FROM_HERE, | 112 BrowserThread::IO, FROM_HERE, |
114 base::Bind(&SendDestroyingVideoSurfaceOnIO, surface_id, | 113 base::Bind(&SendDestroyingVideoSurfaceOnIO, surface_id, |
115 base::Bind(&base::WaitableEvent::Signal, | 114 base::Bind(&base::WaitableEvent::Signal, |
116 base::Unretained(&waiter))))) { | 115 base::Unretained(&waiter))))) { |
117 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 116 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
118 waiter.Wait(); | 117 waiter.Wait(); |
119 } | 118 } |
120 } | 119 } |
121 | 120 |
122 } // namespace content | 121 } // namespace content |
OLD | NEW |