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

Side by Side Diff: mojo/services/network/http_server_impl.cc

Issue 1227373002: Roll mojo SDK to 734c6e1652ff2f3b696e441722838f453f4f9b42 (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Follow review Created 5 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mojo/services/network/http_server_impl.h" 5 #include "mojo/services/network/http_server_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/services/network/http_connection_impl.h" 8 #include "mojo/services/network/http_connection_impl.h"
9 #include "mojo/services/network/net_adapters.h" 9 #include "mojo/services/network/net_adapters.h"
10 #include "mojo/services/network/net_address_type_converters.h" 10 #include "mojo/services/network/net_address_type_converters.h"
(...skipping 22 matching lines...) Expand all
33 callback.Run(MakeNetworkError(net_error), nullptr); 33 callback.Run(MakeNetworkError(net_error), nullptr);
34 delete http_server; 34 delete http_server;
35 return; 35 return;
36 } 36 }
37 callback.Run(MakeNetworkError(net::OK), http_server->GetLocalAddress()); 37 callback.Run(MakeNetworkError(net::OK), http_server->GetLocalAddress());
38 } 38 }
39 39
40 HttpServerImpl::HttpServerImpl(HttpServerDelegatePtr delegate) 40 HttpServerImpl::HttpServerImpl(HttpServerDelegatePtr delegate)
41 : delegate_(delegate.Pass()) { 41 : delegate_(delegate.Pass()) {
42 DCHECK(delegate_); 42 DCHECK(delegate_);
43 delegate_.set_error_handler(this); 43 delegate_.set_connection_error_handler([this]() { delete this; });
44 } 44 }
45 45
46 HttpServerImpl::~HttpServerImpl() {} 46 HttpServerImpl::~HttpServerImpl() {}
47 47
48 int HttpServerImpl::Start(NetAddressPtr local_address) { 48 int HttpServerImpl::Start(NetAddressPtr local_address) {
49 DCHECK(local_address); 49 DCHECK(local_address);
50 50
51 scoped_ptr<net::ServerSocket> socket( 51 scoped_ptr<net::ServerSocket> socket(
52 new net::TCPServerSocket(nullptr, net::NetLog::Source())); 52 new net::TCPServerSocket(nullptr, net::NetLog::Source()));
53 int net_result = socket->Listen(local_address.To<net::IPEndPoint>(), 53 int net_result = socket->Listen(local_address.To<net::IPEndPoint>(),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 const std::string& data) { 105 const std::string& data) {
106 DCHECK(connections_.find(connection_id) != connections_.end()); 106 DCHECK(connections_.find(connection_id) != connections_.end());
107 connections_[connection_id]->OnReceivedWebSocketMessage(data); 107 connections_[connection_id]->OnReceivedWebSocketMessage(data);
108 } 108 }
109 109
110 void HttpServerImpl::OnClose(int connection_id) { 110 void HttpServerImpl::OnClose(int connection_id) {
111 DCHECK(connections_.find(connection_id) != connections_.end()); 111 DCHECK(connections_.find(connection_id) != connections_.end());
112 connections_.erase(connection_id); 112 connections_.erase(connection_id);
113 } 113 }
114 114
115 void HttpServerImpl::OnConnectionError() {
116 delete this;
117 }
118
119 } // namespace mojo 115 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/network/http_server_impl.h ('k') | mojo/services/network/network_service_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698