summaryrefslogtreecommitdiffstats
path: root/cloud_print
diff options
context:
space:
mode:
authorbyungchul@chromium.org <byungchul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-22 18:10:13 +0000
committerbyungchul@chromium.org <byungchul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-22 18:12:05 +0000
commit3626bc39d629245a782c61ba0bc668583778e392 (patch)
tree7156999fdfb9044dd14d5463568b8f6ce01543fe /cloud_print
parent1c2f071e2a14a39b215a897434d30834ae959560 (diff)
downloadchromium_src-3626bc39d629245a782c61ba0bc668583778e392.zip
chromium_src-3626bc39d629245a782c61ba0bc668583778e392.tar.gz
chromium_src-3626bc39d629245a782c61ba0bc668583778e392.tar.bz2
Replace StreamListenSocket with StreamSocket in HttpServer.
1) HttpServer gets ServerSocket instead of StreamListenSocket. 2) HttpConnection is just a container for socket, websocket, and pending read/write buffers. 3) HttpServer handles data buffering and asynchronous read/write. 4) HttpConnection has limit in data buffering, up to 1Mbytes by default. 5) For devtools, send buffer limit is 100Mbytes. 6) Unittests for buffer handling in HttpConnection. BUG=371906 Review URL: https://codereview.chromium.org/296053012 Cr-Commit-Position: refs/heads/master@{#291447} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291447 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cloud_print')
-rw-r--r--cloud_print/gcp20/prototype/privet_http_server.cc12
-rw-r--r--cloud_print/gcp20/prototype/privet_http_server.h3
2 files changed, 8 insertions, 7 deletions
diff --git a/cloud_print/gcp20/prototype/privet_http_server.cc b/cloud_print/gcp20/prototype/privet_http_server.cc
index 9aa2835..41daa81 100644
--- a/cloud_print/gcp20/prototype/privet_http_server.cc
+++ b/cloud_print/gcp20/prototype/privet_http_server.cc
@@ -10,7 +10,7 @@
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/url_util.h"
-#include "net/socket/tcp_listen_socket.h"
+#include "net/socket/tcp_server_socket.h"
#include "url/gurl.h"
namespace {
@@ -105,10 +105,12 @@ bool PrivetHttpServer::Start(uint16 port) {
if (server_)
return true;
- net::TCPListenSocketFactory factory("0.0.0.0", port);
- server_ = new net::HttpServer(factory, this);
- net::IPEndPoint address;
+ scoped_ptr<net::ServerSocket> server_socket(
+ new net::TCPServerSocket(NULL, net::NetLog::Source()));
+ server_socket->ListenWithAddressAndPort("0.0.0.0", port, 1);
+ server_.reset(new net::HttpServer(server_socket.Pass(), this));
+ net::IPEndPoint address;
if (server_->GetLocalAddress(&address) != net::OK) {
NOTREACHED() << "Cannot start HTTP server";
return false;
@@ -122,7 +124,7 @@ void PrivetHttpServer::Shutdown() {
if (!server_)
return;
- server_ = NULL;
+ server_.reset(NULL);
}
void PrivetHttpServer::OnHttpRequest(int connection_id,
diff --git a/cloud_print/gcp20/prototype/privet_http_server.h b/cloud_print/gcp20/prototype/privet_http_server.h
index 4b22e35..6cb14d10 100644
--- a/cloud_print/gcp20/prototype/privet_http_server.h
+++ b/cloud_print/gcp20/prototype/privet_http_server.h
@@ -204,7 +204,7 @@ class PrivetHttpServer: public net::HttpServer::Delegate {
uint16 port_;
// Contains encapsulated object for listening for requests.
- scoped_refptr<net::HttpServer> server_;
+ scoped_ptr<net::HttpServer> server_;
Delegate* delegate_;
@@ -212,4 +212,3 @@ class PrivetHttpServer: public net::HttpServer::Delegate {
};
#endif // CLOUD_PRINT_GCP20_PROTOTYPE_PRIVET_HTTP_SERVER_H_
-