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

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

Issue 8775021: Fix race condition disconnecting hosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use scoped_refptr instead of synchronization. Created 9 years 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 #ifndef LOCAL_INPUT_MONITOR_THREAD_WIN_H_ 5 #ifndef LOCAL_INPUT_MONITOR_THREAD_WIN_H_
6 #define LOCAL_INPUT_MONITOR_THREAD_WIN_H_ 6 #define LOCAL_INPUT_MONITOR_THREAD_WIN_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
11 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
12 #include "base/threading/simple_thread.h" 13 #include "base/threading/simple_thread.h"
13 #include "remoting/host/chromoting_host.h" 14 #include "remoting/host/chromoting_host.h"
14 15
15 namespace remoting { 16 namespace remoting {
16 17
17 class LocalInputMonitorThread : public base::SimpleThread { 18 class LocalInputMonitorThread : public base::SimpleThread {
18 public: 19 public:
19 static void AddHostToInputMonitor(ChromotingHost* host); 20 static void AddHostToInputMonitor(ChromotingHost* host);
20 static void RemoveHostFromInputMonitor(ChromotingHost* host); 21 static void RemoveHostFromInputMonitor(ChromotingHost* host);
21 22
22 private: 23 private:
23 LocalInputMonitorThread(); 24 LocalInputMonitorThread();
24 virtual ~LocalInputMonitorThread(); 25 virtual ~LocalInputMonitorThread();
25 26
26 void AddHost(ChromotingHost* host); 27 void AddHost(ChromotingHost* host);
27 bool RemoveHost(ChromotingHost* host); 28 bool RemoveHost(ChromotingHost* host);
28 29
29 void Stop(); 30 void Stop();
30 virtual void Run() OVERRIDE; // Overridden from SimpleThread. 31 virtual void Run() OVERRIDE; // Overridden from SimpleThread.
31 32
32 void LocalMouseMoved(const SkIPoint& mouse_position); 33 void LocalMouseMoved(const SkIPoint& mouse_position);
33 static LRESULT WINAPI HandleLowLevelMouseEvent(int code, 34 static LRESULT WINAPI HandleLowLevelMouseEvent(int code,
34 WPARAM event_type, 35 WPARAM event_type,
35 LPARAM event_data); 36 LPARAM event_data);
36 37
37 base::Lock hosts_lock_; 38 base::Lock hosts_lock_;
38 typedef std::set<ChromotingHost*> ChromotingHosts; 39 typedef std::set<scoped_refptr<ChromotingHost> > ChromotingHosts;
39 ChromotingHosts hosts_; 40 ChromotingHosts hosts_;
40 41
41 DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorThread); 42 DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorThread);
42 }; 43 };
43 44
44 } // namespace remoting 45 } // namespace remoting
45 46
46 #endif 47 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698