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

Unified Diff: blimp/net/grpc_connection.h

Issue 2462183002: GRPC Stream implementation of HeliumStream
Patch Set: Fixed a few minor 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
Index: blimp/net/grpc_connection.h
diff --git a/blimp/net/grpc_connection.h b/blimp/net/grpc_connection.h
new file mode 100644
index 0000000000000000000000000000000000000000..d6ae51bef514f44f8bfde8961824743886036f4b
--- /dev/null
+++ b/blimp/net/grpc_connection.h
@@ -0,0 +1,47 @@
+// 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.
+
+#ifndef BLIMP_NET_GRPC_CONNECTION_H_
+#define BLIMP_NET_GRPC_CONNECTION_H_
+
+#include <memory>
+
+#include "base/macros.h"
+
+#include "blimp/net/blimp_connection.h"
+#include "blimp/net/blimp_net_export.h"
+
+namespace blimp {
+
+class BlimpMessage;
+class BlimpMessageProcessor;
+class GrpcIncomingForwarder;
+class GrpcOutgoingForwarder;
+class GrpcStream;
+
+// TODO(perumaal): Remove this class after Helium transport layer is setup.
+// A |BlimpConnection| that wraps around a |GrpcClientStream| or a
+// |GrpcEngineStream| converting |HeliumMessage| to/from |BlimpMessage|. This is
+// an interim solution until we have the full Helium protocol in place. It still
+// uses the actual |HeliumStream| interfaces to talk to the gRPC layer so the
+// actual code in those gRPC-related classes will outlive this class.
+class BLIMP_NET_EXPORT GrpcConnection : public BlimpConnection {
+ public:
+ explicit GrpcConnection(std::unique_ptr<GrpcStream> stream_delegate);
+ BlimpMessageProcessor* GetOutgoingMessageProcessor() override;
+ void SetIncomingMessageProcessor(BlimpMessageProcessor* processor) override;
+ ~GrpcConnection() override;
+
+ private:
+ std::unique_ptr<GrpcStream> stream_;
+
+ // Forwarders that convert from |BlimpMessage|s to |HeliumMessage|s (and vice
+ // versa).
+ std::unique_ptr<GrpcOutgoingForwarder> outgoing_forwarder_;
+ std::unique_ptr<GrpcIncomingForwarder> incoming_forwarder_;
+};
+
+} // namespace blimp
+
+#endif // BLIMP_NET_GRPC_CONNECTION_H_

Powered by Google App Engine
This is Rietveld 408576698