OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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>::Leaky g_thread_lock = LAZY_INSTANCE_INITIALIZER; |
17 base::LeakyLazyInstanceTraits<base::Lock> > | |
18 g_thread_lock = LAZY_INSTANCE_INITIALIZER; | |
19 } // namespace | 17 } // namespace |
20 | 18 |
21 | 19 |
22 LocalInputMonitorThread::LocalInputMonitorThread() | 20 LocalInputMonitorThread::LocalInputMonitorThread() |
23 : base::SimpleThread("LocalInputMonitor") { | 21 : base::SimpleThread("LocalInputMonitor") { |
24 } | 22 } |
25 | 23 |
26 LocalInputMonitorThread::~LocalInputMonitorThread() { | 24 LocalInputMonitorThread::~LocalInputMonitorThread() { |
27 DCHECK(hosts_.empty()); | 25 DCHECK(hosts_.empty()); |
28 } | 26 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 105 |
108 void LocalInputMonitorThread::RemoveHostFromInputMonitor(ChromotingHost* host) { | 106 void LocalInputMonitorThread::RemoveHostFromInputMonitor(ChromotingHost* host) { |
109 DCHECK(g_local_input_monitor_thread); | 107 DCHECK(g_local_input_monitor_thread); |
110 base::AutoLock lock(g_thread_lock.Get()); | 108 base::AutoLock lock(g_thread_lock.Get()); |
111 if (g_local_input_monitor_thread->RemoveHost(host)) { | 109 if (g_local_input_monitor_thread->RemoveHost(host)) { |
112 g_local_input_monitor_thread->Stop(); | 110 g_local_input_monitor_thread->Stop(); |
113 delete g_local_input_monitor_thread; | 111 delete g_local_input_monitor_thread; |
114 g_local_input_monitor_thread = NULL; | 112 g_local_input_monitor_thread = NULL; |
115 } | 113 } |
116 } | 114 } |
OLD | NEW |