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

Unified Diff: net/server/http_server.cc

Issue 10386048: Decouple DevTools from socket implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/server/http_server.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/server/http_server.cc
diff --git a/net/server/http_server.cc b/net/server/http_server.cc
index 51ec79fffaef26e0f5013b6762f0bf72df6f707c..2e12d170d952f43106b88a2a0d5931edf0322dbd 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;
}
« no previous file with comments | « net/server/http_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698