| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 render_frame_host_->GetRoutingID(), surface_id)); | 99 render_frame_host_->GetRoutingID(), surface_id)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void BrowserSurfaceViewManager::SendDestroyingVideoSurfaceIfRequired( | 102 void BrowserSurfaceViewManager::SendDestroyingVideoSurfaceIfRequired( |
| 103 int surface_id) { | 103 int surface_id) { |
| 104 // Only send the surface destruction message on JB, where not doing it can | 104 // Only send the surface destruction message on JB, where not doing it can |
| 105 // cause a crash. | 105 // cause a crash. |
| 106 if (base::android::BuildInfo::GetInstance()->sdk_int() >= 18) | 106 if (base::android::BuildInfo::GetInstance()->sdk_int() >= 18) |
| 107 return; | 107 return; |
| 108 | 108 |
| 109 base::WaitableEvent waiter(false, false); | 109 base::WaitableEvent waiter(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 110 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 110 // Unretained is okay because we're waiting on the callback. | 111 // Unretained is okay because we're waiting on the callback. |
| 111 if (BrowserThread::PostTask( | 112 if (BrowserThread::PostTask( |
| 112 BrowserThread::IO, FROM_HERE, | 113 BrowserThread::IO, FROM_HERE, |
| 113 base::Bind(&SendDestroyingVideoSurfaceOnIO, surface_id, | 114 base::Bind(&SendDestroyingVideoSurfaceOnIO, surface_id, |
| 114 base::Bind(&base::WaitableEvent::Signal, | 115 base::Bind(&base::WaitableEvent::Signal, |
| 115 base::Unretained(&waiter))))) { | 116 base::Unretained(&waiter))))) { |
| 116 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 117 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 117 waiter.Wait(); | 118 waiter.Wait(); |
| 118 } | 119 } |
| 119 } | 120 } |
| 120 | 121 |
| 121 } // namespace content | 122 } // namespace content |
| OLD | NEW |