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

Side by Side Diff: net/udp/udp_socket_libevent.h

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
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 NET_UDP_UDP_SOCKET_LIBEVENT_H_ 5 #ifndef NET_UDP_UDP_SOCKET_LIBEVENT_H_
6 #define NET_UDP_UDP_SOCKET_LIBEVENT_H_ 6 #define NET_UDP_UDP_SOCKET_LIBEVENT_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Set the differentiated services flags on outgoing packets. May not 161 // Set the differentiated services flags on outgoing packets. May not
162 // do anything on some platforms. 162 // do anything on some platforms.
163 // Return a network error code. 163 // Return a network error code.
164 int SetDiffServCodePoint(DiffServCodePoint dscp); 164 int SetDiffServCodePoint(DiffServCodePoint dscp);
165 165
166 // Resets the thread to be used for thread-safety checks. 166 // Resets the thread to be used for thread-safety checks.
167 void DetachFromThread(); 167 void DetachFromThread();
168 168
169 private: 169 private:
170 enum SocketOptions { 170 enum SocketOptions {
171 SOCKET_OPTION_REUSE_ADDRESS = 1 << 0, 171 SOCKET_OPTION_REUSE_ADDRESS = 1 << 0,
172 SOCKET_OPTION_BROADCAST = 1 << 1, 172 SOCKET_OPTION_BROADCAST = 1 << 1,
173 SOCKET_OPTION_MULTICAST_LOOP = 1 << 2 173 SOCKET_OPTION_MULTICAST_LOOP = 1 << 2
174 }; 174 };
175 175
176 class ReadWatcher : public base::MessageLoopForIO::Watcher { 176 class ReadWatcher : public base::MessageLoopForIO::Watcher {
177 public: 177 public:
178 explicit ReadWatcher(UDPSocketLibevent* socket) : socket_(socket) {} 178 explicit ReadWatcher(UDPSocketLibevent* socket) : socket_(socket) {}
179 179
180 // MessageLoopForIO::Watcher methods 180 // MessageLoopForIO::Watcher methods
181 181
182 virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE; 182 virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE;
(...skipping 24 matching lines...) Expand all
207 207
208 void DoReadCallback(int rv); 208 void DoReadCallback(int rv);
209 void DoWriteCallback(int rv); 209 void DoWriteCallback(int rv);
210 void DidCompleteRead(); 210 void DidCompleteRead();
211 void DidCompleteWrite(); 211 void DidCompleteWrite();
212 212
213 // Handles stats and logging. |result| is the number of bytes transferred, on 213 // Handles stats and logging. |result| is the number of bytes transferred, on
214 // success, or the net error code on failure. On success, LogRead takes in a 214 // success, or the net error code on failure. On success, LogRead takes in a
215 // sockaddr and its length, which are mandatory, while LogWrite takes in an 215 // sockaddr and its length, which are mandatory, while LogWrite takes in an
216 // optional IPEndPoint. 216 // optional IPEndPoint.
217 void LogRead(int result, const char* bytes, socklen_t addr_len, 217 void LogRead(int result,
218 const char* bytes,
219 socklen_t addr_len,
218 const sockaddr* addr) const; 220 const sockaddr* addr) const;
219 void LogWrite(int result, const char* bytes, const IPEndPoint* address) const; 221 void LogWrite(int result, const char* bytes, const IPEndPoint* address) const;
220 222
221 // Returns the OS error code (or 0 on success). 223 // Returns the OS error code (or 0 on success).
222 int CreateSocket(int addr_family); 224 int CreateSocket(int addr_family);
223 225
224 // Same as SendTo(), except that address is passed by pointer 226 // Same as SendTo(), except that address is passed by pointer
225 // instead of by reference. It is called from Write() with |address| 227 // instead of by reference. It is called from Write() with |address|
226 // set to NULL. 228 // set to NULL.
227 int SendToOrWrite(IOBuffer* buf, 229 int SendToOrWrite(IOBuffer* buf,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 CompletionCallback write_callback_; 293 CompletionCallback write_callback_;
292 294
293 BoundNetLog net_log_; 295 BoundNetLog net_log_;
294 296
295 DISALLOW_COPY_AND_ASSIGN(UDPSocketLibevent); 297 DISALLOW_COPY_AND_ASSIGN(UDPSocketLibevent);
296 }; 298 };
297 299
298 } // namespace net 300 } // namespace net
299 301
300 #endif // NET_UDP_UDP_SOCKET_LIBEVENT_H_ 302 #endif // NET_UDP_UDP_SOCKET_LIBEVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698