From 83088b2c3cf332a53d866c92b8106c26fb2395a3 Mon Sep 17 00:00:00 2001 From: "pliard@chromium.org" Date: Mon, 23 Apr 2012 18:23:26 +0000 Subject: Upstream changes making ListenSocket an abstract class. This is part of Chrome for Android upstreaming. This CL makes ListenSocket an abstract class instead of a concrete class implementing a TCP Listen Socket. This abstraction will be used later to make HttpServer seamlessly operate on TCP sockets and Unix domain sockets (will be upstreamed in a separate CL). The TCP Listen socket implementation, previously in listen_socket.{cc,h}, is now in tcp_listen_socket.{cc,h}. TEST=net_unittests Review URL: http://codereview.chromium.org/10108015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133480 0039d316-1c4b-4281-b951-d872f2087c98 --- net/tools/fetch/http_listen_socket.cc | 16 ++++++++-------- net/tools/fetch/http_listen_socket.h | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'net/tools') diff --git a/net/tools/fetch/http_listen_socket.cc b/net/tools/fetch/http_listen_socket.cc index fc9f5f3..60c6f94 100644 --- a/net/tools/fetch/http_listen_socket.cc +++ b/net/tools/fetch/http_listen_socket.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,7 +16,7 @@ // must run in the IO thread HttpListenSocket::HttpListenSocket(SOCKET s, HttpListenSocket::Delegate* delegate) - : ALLOW_THIS_IN_INITIALIZER_LIST(net::ListenSocket(s, this)), + : ALLOW_THIS_IN_INITIALIZER_LIST(net::TCPListenSocket(s, this)), delegate_(delegate) { } @@ -25,13 +25,13 @@ HttpListenSocket::~HttpListenSocket() { } void HttpListenSocket::Listen() { - net::ListenSocket::Listen(); + net::TCPListenSocket::Listen(); } void HttpListenSocket::Accept() { - SOCKET conn = net::ListenSocket::Accept(socket_); - DCHECK_NE(conn, net::ListenSocket::kInvalidSocket); - if (conn == net::ListenSocket::kInvalidSocket) { + SOCKET conn = net::TCPListenSocket::Accept(socket_); + DCHECK_NE(conn, net::TCPListenSocket::kInvalidSocket); + if (conn == net::TCPListenSocket::kInvalidSocket) { // TODO } else { scoped_refptr sock( @@ -45,8 +45,8 @@ HttpListenSocket* HttpListenSocket::Listen( const std::string& ip, int port, HttpListenSocket::Delegate* delegate) { - SOCKET s = net::ListenSocket::Listen(ip, port); - if (s == net::ListenSocket::kInvalidSocket) { + SOCKET s = net::TCPListenSocket::CreateAndBind(ip, port); + if (s == net::TCPListenSocket::kInvalidSocket) { // TODO (ibrar): error handling } else { HttpListenSocket *serv = new HttpListenSocket(s, delegate); diff --git a/net/tools/fetch/http_listen_socket.h b/net/tools/fetch/http_listen_socket.h index 18e3a46..8a09a9e 100644 --- a/net/tools/fetch/http_listen_socket.h +++ b/net/tools/fetch/http_listen_socket.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,13 +7,13 @@ #pragma once #include "base/message_loop.h" -#include "net/base/listen_socket.h" +#include "net/base/tcp_listen_socket.h" class HttpServerRequestInfo; class HttpServerResponseInfo; // Implements a simple HTTP listen socket on top of the raw socket interface. -class HttpListenSocket : public net::ListenSocket, +class HttpListenSocket : public net::TCPListenSocket, public net::ListenSocket::ListenSocketDelegate { public: class Delegate { -- cgit v1.1