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

Unified Diff: blimp/net/grpc_engine_transport.cc

Issue 2462183002: GRPC Stream implementation of HeliumStream
Patch Set: Address gcasto comments Created 4 years, 1 month 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 | « blimp/net/grpc_engine_transport.h ('k') | blimp/net/grpc_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/grpc_engine_transport.cc
diff --git a/blimp/net/grpc_engine_transport.cc b/blimp/net/grpc_engine_transport.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c21016984967f7d6e766b4f2bbc61d4bbe58027a
--- /dev/null
+++ b/blimp/net/grpc_engine_transport.cc
@@ -0,0 +1,62 @@
+// Copyright 2016 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 "blimp/net/grpc_engine_transport.h"
+
+#include <grpc++/security/server_credentials.h>
+#include <grpc++/server.h>
+#include <grpc++/server_builder.h>
+#include <grpc++/server_context.h>
+#include <grpc/grpc.h>
+
+#include <queue>
+#include <string>
+#include <utility>
+
+#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
+#include "base/synchronization/lock.h"
+#include "base/threading/thread_task_runner_handle.h"
+#include "blimp/common/logging.h"
+#include "blimp/common/proto/blimp_message.pb.h"
+#include "blimp/common/proto/helium_service.grpc.pb.h"
+#include "blimp/net/blimp_message_processor.h"
+#include "blimp/net/blimp_message_pump.h"
+#include "blimp/net/grpc_connection.h"
+#include "blimp/net/grpc_engine_stream.h"
+#include "net/base/net_errors.h"
+
+namespace blimp {
+
+GrpcEngineTransport::GrpcEngineTransport(
+ const AssignmentOptions& assignment_options)
+ : BlimpEngineTransport(), assignment_options_(assignment_options) {
+ DVLOG(1) << "gRPC Engine Initialized @ "
+ << assignment_options.engine_endpoint.ToString();
+}
+
+void GrpcEngineTransport::Connect(const net::CompletionCallback& callback) {
+ std::unique_ptr<GrpcEngineStream> engine_stream =
+ base::MakeUnique<GrpcEngineStream>(assignment_options_, callback);
+ assignment_options_ = engine_stream->GetAssignmentOptions();
+ grpc_connection_ = base::MakeUnique<GrpcConnection>(std::move(engine_stream));
+}
+
+std::unique_ptr<BlimpConnection> GrpcEngineTransport::MakeConnection() {
+ DVLOG(1) << "Grpc Engine finished setup";
+ return std::move(grpc_connection_);
+}
+
+const char* GrpcEngineTransport::GetName() const {
+ return "GRPC";
+}
+
+void GrpcEngineTransport::GetAssignmentOptions(
+ AssignmentOptions* assignment_options) const {
+ *assignment_options = assignment_options_;
+}
+
+GrpcEngineTransport::~GrpcEngineTransport() {}
+
+} // namespace blimp
« no previous file with comments | « blimp/net/grpc_engine_transport.h ('k') | blimp/net/grpc_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698