| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/ozone/platform/drm/gpu/proxy_helpers.h" | 5 #include "ui/ozone/platform/drm/gpu/proxy_helpers.h" |
| 6 | 6 |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 void OnRunPostedTaskAndSignal(const base::Closure& callback, | 13 void OnRunPostedTaskAndSignal(const base::Closure& callback, |
| 14 base::WaitableEvent* wait) { | 14 base::WaitableEvent* wait) { |
| 15 callback.Run(); | 15 callback.Run(); |
| 16 wait->Signal(); | 16 wait->Signal(); |
| 17 } | 17 } |
| 18 | 18 |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 void PostSyncTask( | 21 void PostSyncTask( |
| 22 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 22 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 23 const base::Closure& callback) { | 23 const base::Closure& callback) { |
| 24 base::WaitableEvent wait(false, false); | 24 base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 25 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 25 bool success = task_runner->PostTask( | 26 bool success = task_runner->PostTask( |
| 26 FROM_HERE, base::Bind(OnRunPostedTaskAndSignal, callback, &wait)); | 27 FROM_HERE, base::Bind(OnRunPostedTaskAndSignal, callback, &wait)); |
| 27 if (success) | 28 if (success) |
| 28 wait.Wait(); | 29 wait.Wait(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 } // namespace ui | 32 } // namespace ui |
| OLD | NEW |