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

Side by Side Diff: net/base/tcp_listen_socket.h

Issue 10389007: Change TCPListenSocket::SendInternal to use a non-blocking implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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
« no previous file with comments | « no previous file | net/base/tcp_listen_socket.cc » ('j') | net/base/tcp_listen_socket.cc » ('J')
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 // TCP/IP server that handles IO asynchronously in the specified MessageLoop. 5 // TCP/IP server that handles IO asynchronously in the specified MessageLoop.
6 // These objects are NOT thread safe. They use WSAEVENT handles to monitor 6 // These objects are NOT thread safe. They use WSAEVENT handles to monitor
7 // activity in a given MessageLoop. This means that callbacks will 7 // activity in a given MessageLoop. This means that callbacks will
8 // happen in that loop's thread always and that all other methods (including 8 // happen in that loop's thread always and that all other methods (including
9 // constructors and destructors) should also be called from the same thread. 9 // constructors and destructors) should also be called from the same thread.
10 10
11 #ifndef NET_BASE_TCP_LISTEN_SOCKET_H_ 11 #ifndef NET_BASE_TCP_LISTEN_SOCKET_H_
12 #define NET_BASE_TCP_LISTEN_SOCKET_H_ 12 #define NET_BASE_TCP_LISTEN_SOCKET_H_
13 #pragma once 13 #pragma once
14 14
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 16
17 #if defined(OS_WIN) 17 #if defined(OS_WIN)
18 #include <winsock2.h> 18 #include <winsock2.h>
19 #endif 19 #endif
20 #include <string> 20 #include <string>
21 #if defined(OS_WIN) 21 #if defined(OS_WIN)
22 #include "base/win/object_watcher.h" 22 #include "base/win/object_watcher.h"
23 #elif defined(OS_POSIX) 23 #elif defined(OS_POSIX)
24 #include "base/message_loop.h" 24 #include "base/message_loop.h"
25 #endif 25 #endif
26 26
27 #include "base/basictypes.h" 27 #include "base/basictypes.h"
28 #include "base/compiler_specific.h" 28 #include "base/compiler_specific.h"
29 #include "base/memory/weak_ptr.h"
29 #include "net/base/listen_socket.h" 30 #include "net/base/listen_socket.h"
30 #include "net/base/net_export.h" 31 #include "net/base/net_export.h"
31 32
32 #if defined(OS_POSIX) 33 #if defined(OS_POSIX)
33 typedef int SOCKET; 34 typedef int SOCKET;
34 #endif 35 #endif
35 36
36 namespace net { 37 namespace net {
37 38
38 // Implements a TCP socket interface. Note that this is ref counted. 39 // Implements a TCP socket interface. Note that this is ref counted.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 WaitState wait_state_; 97 WaitState wait_state_;
97 // The socket's libevent wrapper 98 // The socket's libevent wrapper
98 MessageLoopForIO::FileDescriptorWatcher watcher_; 99 MessageLoopForIO::FileDescriptorWatcher watcher_;
99 #endif 100 #endif
100 101
101 SOCKET socket_; 102 SOCKET socket_;
102 103
103 private: 104 private:
104 bool reads_paused_; 105 bool reads_paused_;
105 bool has_pending_reads_; 106 bool has_pending_reads_;
107 bool has_pending_writes_;
108 std::string send_data_;
109
110 // Used to continue sending data asynchronously.
111 base::WeakPtrFactory<TCPListenSocket> weak_factory_;
106 112
107 DISALLOW_COPY_AND_ASSIGN(TCPListenSocket); 113 DISALLOW_COPY_AND_ASSIGN(TCPListenSocket);
108 }; 114 };
109 115
110 } // namespace net 116 } // namespace net
111 117
112 #endif // NET_BASE_TCP_LISTEN_SOCKET_H_ 118 #endif // NET_BASE_TCP_LISTEN_SOCKET_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/tcp_listen_socket.cc » ('j') | net/base/tcp_listen_socket.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698