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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/network/http_connection_impl.cc
diff --git a/mojo/services/network/http_connection_impl.cc b/mojo/services/network/http_connection_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..47449ecd557894cf67ea108407706f7a8e78990f
--- /dev/null
+++ b/mojo/services/network/http_connection_impl.cc
@@ -0,0 +1,73 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/services/network/http_connection_impl.h"
+
+#include <limits>
+
+#include "mojo/services/network/http_server_impl.h"
+#include "mojo/services/network/net_adapters.h"
+#include "net/base/net_errors.h"
+#include "net/server/http_server.h"
+#include "net/server/http_server_request_info.h"
+
+namespace mojo {
+
+HttpConnectionImpl::HttpConnectionImpl(int connection_id,
+ HttpServerImpl* owner,
+ HttpConnectionDelegatePtr delegate,
+ HttpConnectionPtr* connection)
+ : connection_id_(connection_id),
+ owner_(owner),
+ delegate_(delegate.Pass()),
+ binding_(this, connection) {
+ binding_.set_error_handler(this);
+ delegate_.set_error_handler(this);
+}
+
+HttpConnectionImpl::~HttpConnectionImpl() {}
+
+void HttpConnectionImpl::OnReceivedHttpRequest(
+ const net::HttpServerRequestInfo& info) {
+ // TODO(yzshen): implement it.
+}
+
+void HttpConnectionImpl::OnReceivedWebSocketRequest(
+ const net::HttpServerRequestInfo& info) {
+ // TODO(yzshen): implement it.
+}
+
+void HttpConnectionImpl::OnReceivedWebSocketMessage(const std::string& data) {
+ // TODO(yzshen): implement it.
+}
+
+void HttpConnectionImpl::SetSendBufferSize(
+ uint32_t size,
+ const SetSendBufferSizeCallback& callback) {
+ if (size > static_cast<uint32_t>(std::numeric_limits<int32_t>::max()))
+ size = std::numeric_limits<int32_t>::max();
+
+ owner_->server()->SetSendBufferSize(
+ connection_id_, static_cast<int32_t>(size));
+ callback.Run(MakeNetworkError(net::OK));
+}
+
+void HttpConnectionImpl::SetReceiveBufferSize(
+ uint32_t size,
+ const SetReceiveBufferSizeCallback& callback) {
+ if (size > static_cast<uint32_t>(std::numeric_limits<int32_t>::max()))
+ size = std::numeric_limits<int32_t>::max();
+
+ owner_->server()->SetReceiveBufferSize(
+ connection_id_, static_cast<int32_t>(size));
+ callback.Run(MakeNetworkError(net::OK));
+}
+
+void HttpConnectionImpl::OnConnectionError() {
+ // The proxy side of |binding_| or the impl side of |delegate_| has closed the
+ // pipe. The connection is not needed anymore.
+ owner_->server()->Close(connection_id_);
+}
+
+} // namespace mojo
« 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