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

Side by Side Diff: tools/android/forwarder2/daemon.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
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_DAEMON_H_ 5 #ifndef TOOLS_ANDROID_FORWARDER2_DAEMON_H_
6 #define TOOLS_ANDROID_FORWARDER2_DAEMON_H_ 6 #define TOOLS_ANDROID_FORWARDER2_DAEMON_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 12
13 namespace forwarder2 { 13 namespace forwarder2 {
14 14
15 class Socket; 15 class Socket;
16 16
17 // Provides a way to spawn a daemon and communicate with it. 17 // Provides a way to spawn a daemon and communicate with it.
18 class Daemon { 18 class Daemon {
19 public: 19 public:
20 // Callback used by the daemon to shutdown properly. See pipe_notifier.h for 20 // Callback used by the daemon to shutdown properly. See pipe_notifier.h for
21 // more details. 21 // more details.
22 typedef int (*GetExitNotifierFDCallback)(); 22 typedef int (*GetExitNotifierFDCallback)();
23 23
24 class ClientDelegate { 24 class ClientDelegate {
25 public: 25 public:
26 virtual ~ClientDelegate() {} 26 virtual ~ClientDelegate() {}
27 27
28 // Called after the daemon is ready to receive commands. 28 // Called after the daemon is ready to receive commands.
29 virtual void OnDaemonReady(Socket* daemon_socket) = 0; 29 virtual void OnDaemonReady(Socket* daemon_socket) = 0;
30 }; 30 };
31 31
32 class ServerDelegate { 32 class ServerDelegate {
33 public: 33 public:
34 virtual ~ServerDelegate() {} 34 virtual ~ServerDelegate() {}
35 35
36 // Called after the daemon bound its Unix Domain Socket. This can be used to 36 // Called after the daemon bound its Unix Domain Socket. This can be used to
37 // setup signal handlers or perform global initialization. 37 // setup signal handlers or perform global initialization.
38 virtual void Init() = 0; 38 virtual void Init() = 0;
39 39
40 virtual void OnClientConnected(scoped_ptr<Socket> client_socket) = 0; 40 virtual void OnClientConnected(std::unique_ptr<Socket> client_socket) = 0;
41 }; 41 };
42 42
43 // |identifier| should be a unique string identifier. It is used to 43 // |identifier| should be a unique string identifier. It is used to
44 // bind/connect the underlying Unix Domain Socket. 44 // bind/connect the underlying Unix Domain Socket.
45 // Note that this class does not take ownership of |client_delegate| and 45 // Note that this class does not take ownership of |client_delegate| and
46 // |server_delegate|. 46 // |server_delegate|.
47 Daemon(const std::string& log_file_path, 47 Daemon(const std::string& log_file_path,
48 const std::string& identifier, 48 const std::string& identifier,
49 ClientDelegate* client_delegate, 49 ClientDelegate* client_delegate,
50 ServerDelegate* server_delegate, 50 ServerDelegate* server_delegate,
(...skipping 15 matching lines...) Expand all
66 ClientDelegate* const client_delegate_; 66 ClientDelegate* const client_delegate_;
67 ServerDelegate* const server_delegate_; 67 ServerDelegate* const server_delegate_;
68 const GetExitNotifierFDCallback get_exit_fd_callback_; 68 const GetExitNotifierFDCallback get_exit_fd_callback_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(Daemon); 70 DISALLOW_COPY_AND_ASSIGN(Daemon);
71 }; 71 };
72 72
73 } // namespace forwarder2 73 } // namespace forwarder2
74 74
75 #endif // TOOLS_ANDROID_FORWARDER2_DAEMON_H_ 75 #endif // TOOLS_ANDROID_FORWARDER2_DAEMON_H_
OLDNEW
« no previous file with comments | « extensions/renderer/display_source_custom_bindings.h ('k') | tools/android/forwarder2/daemon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698