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

Side by Side Diff: remoting/host/local_input_monitor_mac.mm

Issue 2911893003: Deprecate NonThreadSafe in remoting in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 months 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
« no previous file with comments | « remoting/host/ipc_host_event_logger.cc ('k') | remoting/host/local_input_monitor_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 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.h" 5 #include "remoting/host/local_input_monitor.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/mac/scoped_cftyperef.h" 16 #include "base/mac/scoped_cftyperef.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/sequence_checker.h"
20 #include "base/single_thread_task_runner.h" 21 #include "base/single_thread_task_runner.h"
21 #include "base/synchronization/lock.h" 22 #include "base/synchronization/lock.h"
22 #include "base/threading/non_thread_safe.h"
23 #include "remoting/host/client_session_control.h" 23 #include "remoting/host/client_session_control.h"
24 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMCarbonEvent.h" 24 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMCarbonEvent.h"
25 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" 25 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
26 26
27 // Esc Key Code is 53. 27 // Esc Key Code is 53.
28 // http://boredzo.org/blog/wp-content/uploads/2007/05/IMTx-virtual-keycodes.pdf 28 // http://boredzo.org/blog/wp-content/uploads/2007/05/IMTx-virtual-keycodes.pdf
29 static const NSUInteger kEscKeyCode = 53; 29 static const NSUInteger kEscKeyCode = 53;
30 30
31 namespace remoting { 31 namespace remoting {
32 namespace { 32 namespace {
33 33
34 class LocalInputMonitorMac : public base::NonThreadSafe, 34 class LocalInputMonitorMac : public LocalInputMonitor {
35 public LocalInputMonitor {
36 public: 35 public:
37 // Invoked by LocalInputMonitorManager. 36 // Invoked by LocalInputMonitorManager.
38 class EventHandler { 37 class EventHandler {
39 public: 38 public:
40 virtual ~EventHandler() {} 39 virtual ~EventHandler() {}
41 40
42 virtual void OnLocalMouseMoved(const webrtc::DesktopVector& position) = 0; 41 virtual void OnLocalMouseMoved(const webrtc::DesktopVector& position) = 0;
43 virtual void OnDisconnectShortcut() = 0; 42 virtual void OnDisconnectShortcut() = 0;
44 }; 43 };
45 44
46 LocalInputMonitorMac( 45 LocalInputMonitorMac(
47 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 46 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
48 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 47 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
49 base::WeakPtr<ClientSessionControl> client_session_control); 48 base::WeakPtr<ClientSessionControl> client_session_control);
50 ~LocalInputMonitorMac() override; 49 ~LocalInputMonitorMac() override;
51 50
52 private: 51 private:
53 // The actual implementation resides in LocalInputMonitorMac::Core class. 52 // The actual implementation resides in LocalInputMonitorMac::Core class.
54 class Core; 53 class Core;
55 scoped_refptr<Core> core_; 54 scoped_refptr<Core> core_;
56 55
56 SEQUENCE_CHECKER(sequence_checker_);
57
57 DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorMac); 58 DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorMac);
58 }; 59 };
59 60
60 } // namespace 61 } // namespace
61 } // namespace remoting 62 } // namespace remoting
62 63
63 @interface LocalInputMonitorManager : NSObject { 64 @interface LocalInputMonitorManager : NSObject {
64 @private 65 @private
65 GTMCarbonHotKey* hotKey_; 66 GTMCarbonHotKey* hotKey_;
66 CFRunLoopSourceRef mouseRunLoopSource_; 67 CFRunLoopSourceRef mouseRunLoopSource_;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 203 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
203 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 204 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
204 base::WeakPtr<ClientSessionControl> client_session_control) 205 base::WeakPtr<ClientSessionControl> client_session_control)
205 : core_(new Core(caller_task_runner, 206 : core_(new Core(caller_task_runner,
206 ui_task_runner, 207 ui_task_runner,
207 client_session_control)) { 208 client_session_control)) {
208 core_->Start(); 209 core_->Start();
209 } 210 }
210 211
211 LocalInputMonitorMac::~LocalInputMonitorMac() { 212 LocalInputMonitorMac::~LocalInputMonitorMac() {
213 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
212 core_->Stop(); 214 core_->Stop();
213 } 215 }
214 216
215 LocalInputMonitorMac::Core::Core( 217 LocalInputMonitorMac::Core::Core(
216 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 218 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
217 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 219 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
218 base::WeakPtr<ClientSessionControl> client_session_control) 220 base::WeakPtr<ClientSessionControl> client_session_control)
219 : caller_task_runner_(caller_task_runner), 221 : caller_task_runner_(caller_task_runner),
220 ui_task_runner_(ui_task_runner), 222 ui_task_runner_(ui_task_runner),
221 manager_(nil), 223 manager_(nil),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 std::unique_ptr<LocalInputMonitor> LocalInputMonitor::Create( 284 std::unique_ptr<LocalInputMonitor> LocalInputMonitor::Create(
283 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 285 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
284 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 286 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
285 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 287 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
286 base::WeakPtr<ClientSessionControl> client_session_control) { 288 base::WeakPtr<ClientSessionControl> client_session_control) {
287 return base::WrapUnique(new LocalInputMonitorMac( 289 return base::WrapUnique(new LocalInputMonitorMac(
288 caller_task_runner, ui_task_runner, client_session_control)); 290 caller_task_runner, ui_task_runner, client_session_control));
289 } 291 }
290 292
291 } // namespace remoting 293 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/ipc_host_event_logger.cc ('k') | remoting/host/local_input_monitor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698