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

Side by Side Diff: net/socket/unix_domain_client_socket_posix.h

Issue 376323002: Refactor unix domain socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_
6 #define NET_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/callback.h"
mmenke 2014/07/10 19:07:27 Should be including net/base/completion_callback.h
byungchul 2014/07/11 02:56:32 Done.
12 #include "base/macros.h"
13 #include "net/base/net_export.h"
14 #include "net/socket/stream_socket.h"
15
16 namespace net {
17
18 class SocketLibevent;
19 struct SockaddrStorage;
20
21 // A client socket that uses unix domain socket as the transport layer.
22 class NET_EXPORT UnixDomainClientSocket : public StreamSocket {
23 public:
24 // Builds a client socket with socket_path. The caller should call Connect()
25 // to connect to a server socket.
26 UnixDomainClientSocket(const std::string& socket_path,
27 bool use_abstract_namespace);
28 // Builds a client socket with socket libevent which is already connected.
29 // UnixDomainServerSocket uses this after it accepts a connection.
30 explicit UnixDomainClientSocket(scoped_ptr<SocketLibevent> socket);
mmenke 2014/07/10 19:07:28 should include scoped_ptr
byungchul 2014/07/11 02:56:33 Done.
31
32 virtual ~UnixDomainClientSocket();
33
34 // Fills |address| with |socket_path| and its length. For Android or Linux
35 // platform, it supports abstract namespace.
mmenke 2014/07/10 19:07:27 nit: it->this, namespace->namespaces.
byungchul 2014/07/11 02:56:32 Done.
36 static bool FillAddress(const std::string& socket_path,
37 bool use_abstract_namespace,
38 SockaddrStorage* address);
39
40 // StreamSocket implementation.
41 virtual int Connect(const CompletionCallback& callback) OVERRIDE;
42 virtual void Disconnect() OVERRIDE;
43 virtual bool IsConnected() const OVERRIDE;
44 virtual bool IsConnectedAndIdle() const OVERRIDE;
45 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE;
46 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
47 virtual const BoundNetLog& NetLog() const OVERRIDE;
48 virtual void SetSubresourceSpeculation() OVERRIDE;
49 virtual void SetOmniboxSpeculation() OVERRIDE;
50 virtual bool WasEverUsed() const OVERRIDE;
51 virtual bool UsingTCPFastOpen() const OVERRIDE;
52 virtual bool WasNpnNegotiated() const OVERRIDE;
53 virtual NextProto GetNegotiatedProtocol() const OVERRIDE;
54 virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE;
55
56 // Socket implementation.
57 virtual int Read(IOBuffer* buf, int buf_len,
58 const CompletionCallback& callback) OVERRIDE;
59 virtual int Write(IOBuffer* buf, int buf_len,
60 const CompletionCallback& callback) OVERRIDE;
61 virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
62 virtual int SetSendBufferSize(int32 size) OVERRIDE;
63
64 private:
65 const std::string socket_path_;
66 const bool use_abstract_namespace_;
67 scoped_ptr<SocketLibevent> socket_;
68 BoundNetLog netlog_;
mmenke 2014/07/10 19:07:27 These are generally called net_log_
mmenke 2014/07/10 19:07:27 Should include net/base/net_log.h
mmenke 2014/07/10 19:07:28 Should also have a comment that this BoundNetLog j
byungchul 2014/07/11 02:56:32 Done.
byungchul 2014/07/11 02:56:33 Done.
byungchul 2014/07/11 02:56:33 Done.
69
70 DISALLOW_COPY_AND_ASSIGN(UnixDomainClientSocket);
71 };
72
73 } // namespace net
74
75 #endif // NET_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698