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

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

Issue 9720019: Use scoped_ptr<> to pass ownership in more places. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/local_input_monitor.h ('k') | remoting/host/local_input_monitor_mac.mm » ('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) 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.h" 5 #include "remoting/host/local_input_monitor.h"
6 #include "remoting/host/local_input_monitor_thread_linux.h" 6 #include "remoting/host/local_input_monitor_thread_linux.h"
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace remoting {
12
11 namespace { 13 namespace {
12 14
13 class LocalInputMonitorLinux : public remoting::LocalInputMonitor { 15 class LocalInputMonitorLinux : public LocalInputMonitor {
14 public: 16 public:
15 LocalInputMonitorLinux(); 17 LocalInputMonitorLinux();
16 ~LocalInputMonitorLinux(); 18 ~LocalInputMonitorLinux();
17 19
18 virtual void Start(remoting::ChromotingHost* host) OVERRIDE; 20 virtual void Start(ChromotingHost* host) OVERRIDE;
19 virtual void Stop() OVERRIDE; 21 virtual void Stop() OVERRIDE;
20 22
21 private: 23 private:
22 remoting::LocalInputMonitorThread* thread_; 24 LocalInputMonitorThread* thread_;
23 }; 25 };
24 26
25 } // namespace
26
27
28 LocalInputMonitorLinux::LocalInputMonitorLinux() 27 LocalInputMonitorLinux::LocalInputMonitorLinux()
29 : thread_(NULL) { 28 : thread_(NULL) {
30 } 29 }
31 30
32 LocalInputMonitorLinux::~LocalInputMonitorLinux() { 31 LocalInputMonitorLinux::~LocalInputMonitorLinux() {
33 CHECK(!thread_); 32 CHECK(!thread_);
34 } 33 }
35 34
36 void LocalInputMonitorLinux::Start(remoting::ChromotingHost* host) { 35 void LocalInputMonitorLinux::Start(ChromotingHost* host) {
37 CHECK(!thread_); 36 CHECK(!thread_);
38 thread_ = new remoting::LocalInputMonitorThread(host); 37 thread_ = new LocalInputMonitorThread(host);
39 thread_->Start(); 38 thread_->Start();
40 } 39 }
41 40
42 void LocalInputMonitorLinux::Stop() { 41 void LocalInputMonitorLinux::Stop() {
43 CHECK(thread_); 42 CHECK(thread_);
44 thread_->Stop(); 43 thread_->Stop();
45 thread_->Join(); 44 thread_->Join();
46 delete thread_; 45 delete thread_;
47 thread_ = 0; 46 thread_ = 0;
48 } 47 }
49 48
50 remoting::LocalInputMonitor* remoting::LocalInputMonitor::Create() { 49 } // namespace
51 return new LocalInputMonitorLinux; 50
51 scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create() {
52 return scoped_ptr<LocalInputMonitor>(new LocalInputMonitorLinux());
52 } 53 }
54
55 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/local_input_monitor.h ('k') | remoting/host/local_input_monitor_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698