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

Side by Side Diff: net/server/http_server.cc

Issue 10108015: Upstream changes making ListenSocket an abstract class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add listen_socket.cc. Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/net.gyp ('k') | net/socket/transport_client_socket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/server/http_server.h" 5 #include "net/server/http_server.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "base/sys_byteorder.h" 11 #include "base/sys_byteorder.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "net/base/tcp_listen_socket.h"
13 #include "net/server/http_connection.h" 14 #include "net/server/http_connection.h"
14 #include "net/server/http_server_request_info.h" 15 #include "net/server/http_server_request_info.h"
15 #include "net/server/web_socket.h" 16 #include "net/server/web_socket.h"
16 17
17 namespace net { 18 namespace net {
18 19
19 HttpServer::HttpServer(const std::string& host, 20 HttpServer::HttpServer(const std::string& host,
20 int port, 21 int port,
21 HttpServer::Delegate* del) 22 HttpServer::Delegate* del)
22 : delegate_(del) { 23 : delegate_(del) {
23 server_ = ListenSocket::Listen(host, port, this); 24 server_ = TCPListenSocket::CreateAndListen(host, port, this);
24 } 25 }
25 26
26 HttpServer::~HttpServer() { 27 HttpServer::~HttpServer() {
27 IdToConnectionMap copy = id_to_connection_; 28 IdToConnectionMap copy = id_to_connection_;
28 for (IdToConnectionMap::iterator it = copy.begin(); it != copy.end(); ++it) 29 for (IdToConnectionMap::iterator it = copy.begin(); it != copy.end(); ++it)
29 delete it->second; 30 delete it->second;
30 31
31 server_ = NULL; 32 server_ = NULL;
32 } 33 }
33 34
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 void HttpServer::SendOverWebSocket(int connection_id, 303 void HttpServer::SendOverWebSocket(int connection_id,
303 const std::string& data) { 304 const std::string& data) {
304 HttpConnection* connection = FindConnection(connection_id); 305 HttpConnection* connection = FindConnection(connection_id);
305 if (connection == NULL) 306 if (connection == NULL)
306 return; 307 return;
307 DCHECK(connection->web_socket_.get()); 308 DCHECK(connection->web_socket_.get());
308 connection->web_socket_->Send(data); 309 connection->web_socket_->Send(data);
309 } 310 }
310 311
311 } // namespace net 312 } // namespace net
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/socket/transport_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698