Chromium Code Reviews| 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/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 | 100 |
| 101 bool BrowserSurfaceViewManager::SendSurfaceID(int surface_id) { | 101 bool BrowserSurfaceViewManager::SendSurfaceID(int surface_id) { |
| 102 return render_frame_host_->Send( | 102 return render_frame_host_->Send( |
| 103 new SurfaceViewManagerMsg_FullscreenSurfaceCreated( | 103 new SurfaceViewManagerMsg_FullscreenSurfaceCreated( |
| 104 render_frame_host_->GetRoutingID(), surface_id)); | 104 render_frame_host_->GetRoutingID(), surface_id)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void BrowserSurfaceViewManager::SendDestroyingVideoSurfaceIfRequired( | 107 void BrowserSurfaceViewManager::SendDestroyingVideoSurfaceIfRequired( |
| 108 int surface_id) { | 108 int surface_id) { |
| 109 // Only send the surface destruction message on JB, where not doing it can | 109 // Only send the surface destruction message on JB, where not doing it can |
| 110 // cause a crash. | 110 // cause a crash, and on Marshmallow+ where we can use this signal to perform |
| 111 if (base::android::BuildInfo::GetInstance()->sdk_int() >= 18) | 111 // a smoother full screen transition. |
| 112 if (base::android::BuildInfo::GetInstance()->sdk_int() >= 18 && | |
| 113 base::android::BuildInfo::GetInstance()->sdk_int() < 23) { | |
|
watk
2016/11/03 20:26:34
We might want to just do this always now. I restri
DaleCurtis
2016/11/04 01:07:22
Probably you can use crash/blame with the file pat
| |
| 112 return; | 114 return; |
| 115 } | |
| 113 | 116 |
| 114 base::WaitableEvent waiter(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 117 base::WaitableEvent waiter(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 115 base::WaitableEvent::InitialState::NOT_SIGNALED); | 118 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 116 // Unretained is okay because we're waiting on the callback. | 119 // Unretained is okay because we're waiting on the callback. |
| 117 if (BrowserThread::PostTask( | 120 if (BrowserThread::PostTask( |
| 118 BrowserThread::IO, FROM_HERE, | 121 BrowserThread::IO, FROM_HERE, |
| 119 base::Bind(&SendDestroyingVideoSurfaceOnIO, surface_id, | 122 base::Bind(&SendDestroyingVideoSurfaceOnIO, surface_id, |
| 120 base::Bind(&base::WaitableEvent::Signal, | 123 base::Bind(&base::WaitableEvent::Signal, |
| 121 base::Unretained(&waiter))))) { | 124 base::Unretained(&waiter))))) { |
| 122 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 125 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 123 waiter.Wait(); | 126 waiter.Wait(); |
| 124 } | 127 } |
| 125 } | 128 } |
| 126 | 129 |
| 127 } // namespace content | 130 } // namespace content |
| OLD | NEW |