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

Side by Side Diff: net/base/listen_socket.cc

Issue 6001010: Move platform_thread to base/threading and put in the base namespace. I left ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | « chrome_frame/urlmon_url_request_private.h ('k') | net/disk_cache/block_files.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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 // winsock2.h must be included first in order to ensure it is included before 8 // winsock2.h must be included first in order to ensure it is included before
9 // windows.h. 9 // windows.h.
10 #include <winsock2.h> 10 #include <winsock2.h>
11 #elif defined(OS_POSIX) 11 #elif defined(OS_POSIX)
12 #include <errno.h> 12 #include <errno.h>
13 #include <netinet/in.h> 13 #include <netinet/in.h>
14 #include <sys/socket.h> 14 #include <sys/socket.h>
15 #include <arpa/inet.h> 15 #include <arpa/inet.h>
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 #if defined(USE_SYSTEM_LIBEVENT) 17 #if defined(USE_SYSTEM_LIBEVENT)
18 #include <event.h> 18 #include <event.h>
19 #else 19 #else
20 #include "third_party/libevent/event.h" 20 #include "third_party/libevent/event.h"
21 #endif 21 #endif
22 #endif 22 #endif
23 23
24 #include "base/eintr_wrapper.h" 24 #include "base/eintr_wrapper.h"
25 #include "base/threading/platform_thread.h"
25 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
26 #include "net/base/listen_socket.h" 27 #include "net/base/listen_socket.h"
27 28
28 #if defined(OS_WIN) 29 #if defined(OS_WIN)
29 typedef int socklen_t; 30 typedef int socklen_t;
30 #endif // defined(OS_WIN) 31 #endif // defined(OS_WIN)
31 32
32 namespace { 33 namespace {
33 34
34 const int kReadBufSize = 4096; 35 const int kReadBufSize = 4096;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 break; 225 break;
225 } 226 }
226 // Otherwise we would block, and now we have to wait for a retry. 227 // Otherwise we would block, and now we have to wait for a retry.
227 // Fall through to PlatformThread::YieldCurrentThread() 228 // Fall through to PlatformThread::YieldCurrentThread()
228 } else { 229 } else {
229 // sent != len_left according to the shortcut above. 230 // sent != len_left according to the shortcut above.
230 // Shift the buffer start and send the remainder after a short while. 231 // Shift the buffer start and send the remainder after a short while.
231 send_buf += sent; 232 send_buf += sent;
232 len_left -= sent; 233 len_left -= sent;
233 } 234 }
234 PlatformThread::YieldCurrentThread(); 235 base::PlatformThread::YieldCurrentThread();
235 } 236 }
236 } 237 }
237 238
238 void ListenSocket::Send(const char* bytes, int len, bool append_linefeed) { 239 void ListenSocket::Send(const char* bytes, int len, bool append_linefeed) {
239 SendInternal(bytes, len); 240 SendInternal(bytes, len);
240 if (append_linefeed) { 241 if (append_linefeed) {
241 SendInternal("\r\n", 2); 242 SendInternal("\r\n", 2);
242 } 243 }
243 } 244 }
244 245
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 311 }
311 } 312 }
312 313
313 void ListenSocket::OnFileCanWriteWithoutBlocking(int fd) { 314 void ListenSocket::OnFileCanWriteWithoutBlocking(int fd) {
314 // MessagePumpLibevent callback, we don't listen for write events 315 // MessagePumpLibevent callback, we don't listen for write events
315 // so we shouldn't ever reach here. 316 // so we shouldn't ever reach here.
316 NOTREACHED(); 317 NOTREACHED();
317 } 318 }
318 319
319 #endif 320 #endif
OLDNEW
« no previous file with comments | « chrome_frame/urlmon_url_request_private.h ('k') | net/disk_cache/block_files.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698