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

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

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « net/socket/mock_client_socket_pool_manager.h ('k') | net/socket/socket_test_util.h » ('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 2014 The Chromium Authors. All rights reserved. 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 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 NET_SOCKET_SOCKET_LIBEVENT_H_ 5 #ifndef NET_SOCKET_SOCKET_LIBEVENT_H_
6 #define NET_SOCKET_SOCKET_LIBEVENT_H_ 6 #define NET_SOCKET_SOCKET_LIBEVENT_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "net/base/completion_callback.h" 15 #include "net/base/completion_callback.h"
16 #include "net/base/net_util.h" 16 #include "net/base/net_util.h"
17 #include "net/socket/socket_descriptor.h" 17 #include "net/socket/socket_descriptor.h"
18 18
19 namespace net { 19 namespace net {
20 20
21 class IOBuffer; 21 class IOBuffer;
22 class IPEndPoint; 22 class IPEndPoint;
23 23
24 // Socket class to provide asynchronous read/write operations on top of the 24 // Socket class to provide asynchronous read/write operations on top of the
25 // posix socket api. It supports AF_INET, AF_INET6, and AF_UNIX addresses. 25 // posix socket api. It supports AF_INET, AF_INET6, and AF_UNIX addresses.
26 class NET_EXPORT_PRIVATE SocketLibevent 26 class NET_EXPORT_PRIVATE SocketLibevent
27 : public base::MessageLoopForIO::Watcher { 27 : public base::MessageLoopForIO::Watcher {
28 public: 28 public:
29 SocketLibevent(); 29 SocketLibevent();
30 virtual ~SocketLibevent(); 30 ~SocketLibevent() override;
31 31
32 // Opens a socket and returns net::OK if |address_family| is AF_INET, AF_INET6 32 // Opens a socket and returns net::OK if |address_family| is AF_INET, AF_INET6
33 // or AF_UNIX. Otherwise, it does DCHECK() and returns a net error. 33 // or AF_UNIX. Otherwise, it does DCHECK() and returns a net error.
34 int Open(int address_family); 34 int Open(int address_family);
35 // Takes ownership of |socket|. 35 // Takes ownership of |socket|.
36 int AdoptConnectedSocket(SocketDescriptor socket, 36 int AdoptConnectedSocket(SocketDescriptor socket,
37 const SockaddrStorage& peer_address); 37 const SockaddrStorage& peer_address);
38 // Releases ownership of |socket_fd_| to caller. 38 // Releases ownership of |socket_fd_| to caller.
39 SocketDescriptor ReleaseConnectedSocket(); 39 SocketDescriptor ReleaseConnectedSocket();
40 40
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 void SetPeerAddress(const SockaddrStorage& address); 74 void SetPeerAddress(const SockaddrStorage& address);
75 // Returns true if peer address has been set regardless of socket state. 75 // Returns true if peer address has been set regardless of socket state.
76 bool HasPeerAddress() const; 76 bool HasPeerAddress() const;
77 77
78 void Close(); 78 void Close();
79 79
80 SocketDescriptor socket_fd() const { return socket_fd_; } 80 SocketDescriptor socket_fd() const { return socket_fd_; }
81 81
82 private: 82 private:
83 // base::MessageLoopForIO::Watcher methods. 83 // base::MessageLoopForIO::Watcher methods.
84 virtual void OnFileCanReadWithoutBlocking(int fd) override; 84 void OnFileCanReadWithoutBlocking(int fd) override;
85 virtual void OnFileCanWriteWithoutBlocking(int fd) override; 85 void OnFileCanWriteWithoutBlocking(int fd) override;
86 86
87 int DoAccept(scoped_ptr<SocketLibevent>* socket); 87 int DoAccept(scoped_ptr<SocketLibevent>* socket);
88 void AcceptCompleted(); 88 void AcceptCompleted();
89 89
90 int DoConnect(); 90 int DoConnect();
91 void ConnectCompleted(); 91 void ConnectCompleted();
92 92
93 int DoRead(IOBuffer* buf, int buf_len); 93 int DoRead(IOBuffer* buf, int buf_len);
94 void ReadCompleted(); 94 void ReadCompleted();
95 95
(...skipping 27 matching lines...) Expand all
123 scoped_ptr<SockaddrStorage> peer_address_; 123 scoped_ptr<SockaddrStorage> peer_address_;
124 124
125 base::ThreadChecker thread_checker_; 125 base::ThreadChecker thread_checker_;
126 126
127 DISALLOW_COPY_AND_ASSIGN(SocketLibevent); 127 DISALLOW_COPY_AND_ASSIGN(SocketLibevent);
128 }; 128 };
129 129
130 } // namespace net 130 } // namespace net
131 131
132 #endif // NET_SOCKET_SOCKET_LIBEVENT_H_ 132 #endif // NET_SOCKET_SOCKET_LIBEVENT_H_
OLDNEW
« no previous file with comments | « net/socket/mock_client_socket_pool_manager.h ('k') | net/socket/socket_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698