| OLD | NEW |
| 1 // Copyright (c) 2010 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 #ifdef _WIN32 | 5 #ifdef _WIN32 |
| 6 #include <winsock2.h> | 6 #include <winsock2.h> |
| 7 #else | 7 #else |
| 8 #include <arpa/inet.h> | 8 #include <arpa/inet.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // must run in the IO thread | 30 // must run in the IO thread |
| 31 HttpListenSocket::~HttpListenSocket() { | 31 HttpListenSocket::~HttpListenSocket() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void HttpListenSocket::Accept() { | 34 void HttpListenSocket::Accept() { |
| 35 SOCKET conn = ListenSocket::Accept(socket_); | 35 SOCKET conn = ListenSocket::Accept(socket_); |
| 36 DCHECK_NE(conn, ListenSocket::kInvalidSocket); | 36 DCHECK_NE(conn, ListenSocket::kInvalidSocket); |
| 37 if (conn == ListenSocket::kInvalidSocket) { | 37 if (conn == ListenSocket::kInvalidSocket) { |
| 38 // TODO | 38 // TODO |
| 39 } else { | 39 } else { |
| 40 scoped_refptr<HttpListenSocket> sock = | 40 scoped_refptr<HttpListenSocket> sock( |
| 41 new HttpListenSocket(conn, delegate_); | 41 new HttpListenSocket(conn, delegate_)); |
| 42 #if defined(OS_POSIX) | 42 #if defined(OS_POSIX) |
| 43 sock->WatchSocket(WAITING_READ); | 43 sock->WatchSocket(WAITING_READ); |
| 44 #endif | 44 #endif |
| 45 // it's up to the delegate to AddRef if it wants to keep it around | 45 // it's up to the delegate to AddRef if it wants to keep it around |
| 46 DidAccept(this, sock); | 46 DidAccept(this, sock); |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 HttpListenSocket* HttpListenSocket::Listen( | 50 HttpListenSocket* HttpListenSocket::Listen( |
| 51 const std::string& ip, | 51 const std::string& ip, |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 delegate_->OnHttpRequest(this, request); | 342 delegate_->OnHttpRequest(this, request); |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 void HttpListenSocket::DidClose(ListenSocket* sock) { | 346 void HttpListenSocket::DidClose(ListenSocket* sock) { |
| 347 sock->Release(); | 347 sock->Release(); |
| 348 delegate_->OnClose(this); | 348 delegate_->OnClose(this); |
| 349 } | 349 } |
| OLD | NEW |