summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-05 23:34:24 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-05 23:34:24 +0000
commit5389bc7ba5360633af04b9cf15497d56ce640ead (patch)
tree4518c05f3bad18a5b2f4739fc1a1c187651f9799 /net/tools
parent4070a6b1efcb2dbea12508a0b912cfa3bc86f47e (diff)
downloadchromium_src-5389bc7ba5360633af04b9cf15497d56ce640ead.zip
chromium_src-5389bc7ba5360633af04b9cf15497d56ce640ead.tar.gz
chromium_src-5389bc7ba5360633af04b9cf15497d56ce640ead.tar.bz2
Second patch in making destructors of refcounted objects private.
BUG=26749 Review URL: http://codereview.chromium.org/368001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31165 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rw-r--r--net/tools/fetch/fetch_client.cc2
-rw-r--r--net/tools/fetch/http_listen_socket.h10
-rw-r--r--net/tools/fetch/http_session.h54
3 files changed, 34 insertions, 32 deletions
diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc
index 4c4ac46..f40c9e7 100644
--- a/net/tools/fetch/fetch_client.cc
+++ b/net/tools/fetch/fetch_client.cc
@@ -107,7 +107,7 @@ class Client {
GURL url_;
net::HttpRequestInfo request_info_;
scoped_ptr<net::HttpTransaction> transaction_;
- scoped_ptr<net::IOBuffer> buffer_;
+ scoped_refptr<net::IOBuffer> buffer_;
net::CompletionCallbackImpl<Client> connect_callback_;
net::CompletionCallbackImpl<Client> read_callback_;
Singleton<Driver> driver_;
diff --git a/net/tools/fetch/http_listen_socket.h b/net/tools/fetch/http_listen_socket.h
index f31df20..bb6d383 100644
--- a/net/tools/fetch/http_listen_socket.h
+++ b/net/tools/fetch/http_listen_socket.h
@@ -14,16 +14,15 @@ class HttpServerResponseInfo;
// Implements a simple HTTP listen socket on top of the raw socket interface.
class HttpListenSocket : public ListenSocket,
public ListenSocket::ListenSocketDelegate {
-public:
+ public:
class Delegate {
public:
- virtual void OnRequest(HttpListenSocket* connection,
+ virtual void OnRequest(HttpListenSocket* connection,
HttpServerRequestInfo* info) = 0;
};
static HttpListenSocket* Listen(const std::string& ip, int port,
HttpListenSocket::Delegate* delegate);
- virtual ~HttpListenSocket();
void Listen() { ListenSocket::Listen(); }
virtual void Accept();
@@ -37,9 +36,12 @@ public:
virtual void DidRead(ListenSocket* connection, const std::string& data);
virtual void DidClose(ListenSocket* sock);
-private:
+ private:
+ friend class base::RefCountedThreadSafe<ListenSocket>;
+
static const int kReadBufSize = 16 * 1024;
HttpListenSocket(SOCKET s, HttpListenSocket::Delegate* del);
+ virtual ~HttpListenSocket();
// Expects the raw data to be stored in recv_data_. If parsing is successful,
// will remove the data parsed from recv_data_, leaving only the unused
diff --git a/net/tools/fetch/http_session.h b/net/tools/fetch/http_session.h
index 2289b30..4d9e84b 100644
--- a/net/tools/fetch/http_session.h
+++ b/net/tools/fetch/http_session.h
@@ -1,27 +1,27 @@
-// Copyright (c) 2009 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.
-
-#ifndef NET_BASE_TOOLS_HTTP_SESSION_H_
-#define NET_BASE_TOOLS_HTTP_SESSION_H_
-
-#include "base/basictypes.h"
-#include "net/http/http_request_info.h"
-#include "net/tools/fetch/http_listen_socket.h"
-
-// An HttpSession encapsulates a server-side HTTP listen socket.
-class HttpSession : HttpListenSocket::Delegate {
-public:
- HttpSession(const std::string& ip, int port);
- virtual ~HttpSession();
-
- virtual void OnRequest(HttpListenSocket* connection,
- HttpServerRequestInfo* info);
-
-private:
- scoped_ptr<HttpListenSocket> socket_;
- DISALLOW_EVIL_CONSTRUCTORS(HttpSession);
-};
-
-#endif // NET_BASE_TOOLS_HTTP_SESSION_H_
-
+// Copyright (c) 2009 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.
+
+#ifndef NET_BASE_TOOLS_HTTP_SESSION_H_
+#define NET_BASE_TOOLS_HTTP_SESSION_H_
+
+#include "base/basictypes.h"
+#include "net/http/http_request_info.h"
+#include "net/tools/fetch/http_listen_socket.h"
+
+// An HttpSession encapsulates a server-side HTTP listen socket.
+class HttpSession : HttpListenSocket::Delegate {
+ public:
+ HttpSession(const std::string& ip, int port);
+ virtual ~HttpSession();
+
+ virtual void OnRequest(HttpListenSocket* connection,
+ HttpServerRequestInfo* info);
+
+ private:
+ scoped_refptr<HttpListenSocket> socket_;
+ DISALLOW_EVIL_CONSTRUCTORS(HttpSession);
+};
+
+#endif // NET_BASE_TOOLS_HTTP_SESSION_H_
+