| 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 "blimp/client/feature/compositor/blimp_input_manager.h" | 5 #include "blimp/client/feature/compositor/blimp_input_manager.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 FROM_HERE, | 40 FROM_HERE, |
| 41 base::Bind( | 41 base::Bind( |
| 42 &BlimpInputManager::CreateInputHandlerWrapperOnCompositorThread, | 42 &BlimpInputManager::CreateInputHandlerWrapperOnCompositorThread, |
| 43 base::Unretained(this), weak_factory_.GetWeakPtr(), | 43 base::Unretained(this), weak_factory_.GetWeakPtr(), |
| 44 input_handler)); | 44 input_handler)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 BlimpInputManager::~BlimpInputManager() { | 47 BlimpInputManager::~BlimpInputManager() { |
| 48 DCHECK(IsMainThread()); | 48 DCHECK(IsMainThread()); |
| 49 | 49 |
| 50 base::WaitableEvent shutdown_event(false /* manual_reset */, | 50 base::WaitableEvent shutdown_event( |
| 51 false /* initially_signaled */); | 51 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 52 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 52 { | 53 { |
| 53 base::AutoReset<bool> auto_reset_main_thread_blocked( | 54 base::AutoReset<bool> auto_reset_main_thread_blocked( |
| 54 &main_thread_blocked_, true); | 55 &main_thread_blocked_, true); |
| 55 compositor_task_runner_->PostTask( | 56 compositor_task_runner_->PostTask( |
| 56 FROM_HERE, | 57 FROM_HERE, |
| 57 base::Bind( | 58 base::Bind( |
| 58 &BlimpInputManager::ShutdownOnCompositorThread, | 59 &BlimpInputManager::ShutdownOnCompositorThread, |
| 59 base::Unretained(this), &shutdown_event)); | 60 base::Unretained(this), &shutdown_event)); |
| 60 shutdown_event.Wait(); | 61 shutdown_event.Wait(); |
| 61 } | 62 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 bool BlimpInputManager::IsMainThread() const { | 146 bool BlimpInputManager::IsMainThread() const { |
| 146 return main_task_runner_->BelongsToCurrentThread(); | 147 return main_task_runner_->BelongsToCurrentThread(); |
| 147 } | 148 } |
| 148 | 149 |
| 149 bool BlimpInputManager::IsCompositorThread() const { | 150 bool BlimpInputManager::IsCompositorThread() const { |
| 150 return compositor_task_runner_->BelongsToCurrentThread(); | 151 return compositor_task_runner_->BelongsToCurrentThread(); |
| 151 } | 152 } |
| 152 | 153 |
| 153 } // namespace client | 154 } // namespace client |
| 154 } // namespace blimp | 155 } // namespace blimp |
| OLD | NEW |