summaryrefslogtreecommitdiffstats
path: root/net/server/http_server.cc
diff options
context:
space:
mode:
authorpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-23 17:05:31 +0000
committerpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-23 17:05:31 +0000
commit8bf9ce70928f0aa18cfb64e8a965a1c0c142d41a (patch)
tree2ddb61e88770d2bf433597b1844a224fa5eb65b7 /net/server/http_server.cc
parenteeb34acdcb336c7052cef2014467baa716de89c8 (diff)
downloadchromium_src-8bf9ce70928f0aa18cfb64e8a965a1c0c142d41a.zip
chromium_src-8bf9ce70928f0aa18cfb64e8a965a1c0c142d41a.tar.gz
chromium_src-8bf9ce70928f0aa18cfb64e8a965a1c0c142d41a.tar.bz2
Decouple DevTools from socket implementation.
This is part of Chrome for Android upstreaming. This will let us use a UnixDomainSocket for DevTools on Android. Note that this CL depends on CL 10161005 (which should land soon). TEST=net_unittests Review URL: https://chromiumcodereview.appspot.com/10386048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/server/http_server.cc')
-rw-r--r--net/server/http_server.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/net/server/http_server.cc b/net/server/http_server.cc
index 51ec79f..2e12d17 100644
--- a/net/server/http_server.cc
+++ b/net/server/http_server.cc
@@ -6,6 +6,7 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
+#include "base/stl_util.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/sys_byteorder.h"
@@ -17,11 +18,11 @@
namespace net {
-HttpServer::HttpServer(const std::string& host,
- int port,
- HttpServer::Delegate* del)
- : delegate_(del) {
- server_ = TCPListenSocket::CreateAndListen(host, port, this);
+HttpServer::HttpServer(const StreamListenSocketFactory& factory,
+ HttpServer::Delegate* delegate)
+ : delegate_(delegate),
+ ALLOW_THIS_IN_INITIALIZER_LIST(server_(factory.CreateAndListen(this))) {
+ DCHECK(server_);
}
void HttpServer::AcceptWebSocket(
@@ -157,10 +158,8 @@ void HttpServer::DidClose(StreamListenSocket* socket) {
}
HttpServer::~HttpServer() {
- IdToConnectionMap copy = id_to_connection_;
- for (IdToConnectionMap::iterator it = copy.begin(); it != copy.end(); ++it)
- delete it->second;
-
+ STLDeleteContainerPairSecondPointers(
+ id_to_connection_.begin(), id_to_connection_.end());
server_ = NULL;
}