Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: remoting/host/local_input_monitor_thread_win.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thakis comment, renamed LAZY_INSTANCE_INITIALIZER Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698