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

Side by Side Diff: tools/android/forwarder2/forwarder.h

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 years, 8 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 | « tools/android/forwarder2/device_listener.cc ('k') | tools/android/forwarder2/forwarder.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 #ifndef TOOLS_ANDROID_FORWARDER2_FORWARDER_H_ 5 #ifndef TOOLS_ANDROID_FORWARDER2_FORWARDER_H_
6 #define TOOLS_ANDROID_FORWARDER2_FORWARDER_H_ 6 #define TOOLS_ANDROID_FORWARDER2_FORWARDER_H_
7 7
8 #include <sys/select.h> 8 #include <sys/select.h>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include <memory>
11
11 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
12 13
13 namespace forwarder2 { 14 namespace forwarder2 {
14 15
15 class Socket; 16 class Socket;
16 17
17 // Internal class that forwards traffic between |socket1| and |socket2|. Note 18 // Internal class that forwards traffic between |socket1| and |socket2|. Note
18 // that this class is not thread-safe. 19 // that this class is not thread-safe.
19 class Forwarder { 20 class Forwarder {
20 public: 21 public:
21 Forwarder(scoped_ptr<Socket> socket1, scoped_ptr<Socket> socket2); 22 Forwarder(std::unique_ptr<Socket> socket1, std::unique_ptr<Socket> socket2);
22 23
23 ~Forwarder(); 24 ~Forwarder();
24 25
25 void RegisterFDs(fd_set* read_fds, fd_set* write_fds, int* max_fd); 26 void RegisterFDs(fd_set* read_fds, fd_set* write_fds, int* max_fd);
26 27
27 void ProcessEvents(const fd_set& read_fds, const fd_set& write_fds); 28 void ProcessEvents(const fd_set& read_fds, const fd_set& write_fds);
28 29
29 bool IsClosed() const; 30 bool IsClosed() const;
30 31
31 void Shutdown(); 32 void Shutdown();
32 33
33 private: 34 private:
34 class BufferedCopier; 35 class BufferedCopier;
35 36
36 base::ThreadChecker thread_checker_; 37 base::ThreadChecker thread_checker_;
37 const scoped_ptr<Socket> socket1_; 38 const std::unique_ptr<Socket> socket1_;
38 const scoped_ptr<Socket> socket2_; 39 const std::unique_ptr<Socket> socket2_;
39 // Copies data from socket1 to socket2. 40 // Copies data from socket1 to socket2.
40 const scoped_ptr<BufferedCopier> buffer1_; 41 const std::unique_ptr<BufferedCopier> buffer1_;
41 // Copies data from socket2 to socket1. 42 // Copies data from socket2 to socket1.
42 const scoped_ptr<BufferedCopier> buffer2_; 43 const std::unique_ptr<BufferedCopier> buffer2_;
43 }; 44 };
44 45
45 } // namespace forwarder2 46 } // namespace forwarder2
46 47
47 #endif // TOOLS_ANDROID_FORWARDER2_FORWARDER_H_ 48 #endif // TOOLS_ANDROID_FORWARDER2_FORWARDER_H_
OLDNEW
« no previous file with comments | « tools/android/forwarder2/device_listener.cc ('k') | tools/android/forwarder2/forwarder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698