OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "remoting/host/local_input_monitor_thread_win.h" | 5 #include "remoting/host/local_input_monitor_thread_win.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 | 9 |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 | 11 |
12 using namespace remoting; | 12 using namespace remoting; |
13 | 13 |
14 namespace { | 14 namespace { |
15 LocalInputMonitorThread* g_local_input_monitor_thread = NULL; | 15 LocalInputMonitorThread* g_local_input_monitor_thread = NULL; |
16 base::LazyInstance<base::Lock, | 16 base::LazyInstance<base::Lock, |
17 base::LeakyLazyInstanceTraits<base::Lock> > | 17 base::LeakyLazyInstanceTraits<base::Lock> > |
18 g_thread_lock(base::LINKER_INITIALIZED); | 18 g_thread_lock = LAZY_INSTANCE_INITIALIZER; |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 | 21 |
22 LocalInputMonitorThread::LocalInputMonitorThread() | 22 LocalInputMonitorThread::LocalInputMonitorThread() |
23 : base::SimpleThread("LocalInputMonitor") { | 23 : base::SimpleThread("LocalInputMonitor") { |
24 } | 24 } |
25 | 25 |
26 LocalInputMonitorThread::~LocalInputMonitorThread() { | 26 LocalInputMonitorThread::~LocalInputMonitorThread() { |
27 DCHECK(hosts_.empty()); | 27 DCHECK(hosts_.empty()); |
28 } | 28 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 void LocalInputMonitorThread::RemoveHostFromInputMonitor(ChromotingHost* host) { | 108 void LocalInputMonitorThread::RemoveHostFromInputMonitor(ChromotingHost* host) { |
109 DCHECK(g_local_input_monitor_thread); | 109 DCHECK(g_local_input_monitor_thread); |
110 base::AutoLock lock(g_thread_lock.Get()); | 110 base::AutoLock lock(g_thread_lock.Get()); |
111 if (g_local_input_monitor_thread->RemoveHost(host)) { | 111 if (g_local_input_monitor_thread->RemoveHost(host)) { |
112 g_local_input_monitor_thread->Stop(); | 112 g_local_input_monitor_thread->Stop(); |
113 delete g_local_input_monitor_thread; | 113 delete g_local_input_monitor_thread; |
114 g_local_input_monitor_thread = NULL; | 114 g_local_input_monitor_thread = NULL; |
115 } | 115 } |
116 } | 116 } |
OLD | NEW |