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

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

Issue 1134883002: Mojo service implementation for HTTP server - part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « mojo/services/network/http_connection_impl.h ('k') | mojo/services/network/http_server_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/services/network/http_connection_impl.h"
6
7 #include <limits>
8
9 #include "mojo/services/network/http_server_impl.h"
10 #include "mojo/services/network/net_adapters.h"
11 #include "net/base/net_errors.h"
12 #include "net/server/http_server.h"
13 #include "net/server/http_server_request_info.h"
14
15 namespace mojo {
16
17 HttpConnectionImpl::HttpConnectionImpl(int connection_id,
18 HttpServerImpl* owner,
19 HttpConnectionDelegatePtr delegate,
20 HttpConnectionPtr* connection)
21 : connection_id_(connection_id),
22 owner_(owner),
23 delegate_(delegate.Pass()),
24 binding_(this, connection) {
25 binding_.set_error_handler(this);
26 delegate_.set_error_handler(this);
27 }
28
29 HttpConnectionImpl::~HttpConnectionImpl() {}
30
31 void HttpConnectionImpl::OnReceivedHttpRequest(
32 const net::HttpServerRequestInfo& info) {
33 // TODO(yzshen): implement it.
34 }
35
36 void HttpConnectionImpl::OnReceivedWebSocketRequest(
37 const net::HttpServerRequestInfo& info) {
38 // TODO(yzshen): implement it.
39 }
40
41 void HttpConnectionImpl::OnReceivedWebSocketMessage(const std::string& data) {
42 // TODO(yzshen): implement it.
43 }
44
45 void HttpConnectionImpl::SetSendBufferSize(
46 uint32_t size,
47 const SetSendBufferSizeCallback& callback) {
48 if (size > static_cast<uint32_t>(std::numeric_limits<int32_t>::max()))
49 size = std::numeric_limits<int32_t>::max();
50
51 owner_->server()->SetSendBufferSize(
52 connection_id_, static_cast<int32_t>(size));
53 callback.Run(MakeNetworkError(net::OK));
54 }
55
56 void HttpConnectionImpl::SetReceiveBufferSize(
57 uint32_t size,
58 const SetReceiveBufferSizeCallback& callback) {
59 if (size > static_cast<uint32_t>(std::numeric_limits<int32_t>::max()))
60 size = std::numeric_limits<int32_t>::max();
61
62 owner_->server()->SetReceiveBufferSize(
63 connection_id_, static_cast<int32_t>(size));
64 callback.Run(MakeNetworkError(net::OK));
65 }
66
67 void HttpConnectionImpl::OnConnectionError() {
68 // The proxy side of |binding_| or the impl side of |delegate_| has closed the
69 // pipe. The connection is not needed anymore.
70 owner_->server()->Close(connection_id_);
71 }
72
73 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/network/http_connection_impl.h ('k') | mojo/services/network/http_server_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698