Chromium Code Reviews| Index: net/server/http_server.cc |
| diff --git a/net/server/http_server.cc b/net/server/http_server.cc |
| index 51ec79fffaef26e0f5013b6762f0bf72df6f707c..6befa6784b848184d792afd3e1afc08797f51594 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(HttpServer::Delegate* delegate, |
| + StreamListenSocketFactory* factory) |
| + : delegate_(delegate), |
| + ALLOW_THIS_IN_INITIALIZER_LIST(server_(factory->CreateAndListen(this))) { |
|
mmenke
2012/05/14 20:45:19
nit: Fix indent.
Philippe
2012/05/15 14:39:09
Done.
|
| + 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; |
| } |