Index: blimp/net/grpc_client_stream.h |
diff --git a/blimp/net/grpc_client_stream.h b/blimp/net/grpc_client_stream.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8fe3bb7dd8e6c6e3a18ad67fb585a2e28eb791e7 |
--- /dev/null |
+++ b/blimp/net/grpc_client_stream.h |
@@ -0,0 +1,59 @@ |
+// 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_CLIENT_STREAM_H_ |
+#define BLIMP_NET_GRPC_CLIENT_STREAM_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> |
Garrett Casto
2016/11/11 00:15:53
Nit: We may want to have a discussion on how we re
|
+ |
+#include <memory> |
+ |
+#include "base/callback.h" |
+#include "base/threading/thread_checker.h" |
+ |
+#include "blimp/common/assignment_options.h" |
+#include "blimp/common/logging.h" |
+#include "blimp/common/proto/helium_service.grpc.pb.h" |
+#include "blimp/net/blimp_net_export.h" |
+#include "blimp/net/grpc_stream.h" |
+ |
+#include "net/base/completion_callback.h" |
+ |
+namespace grpc { |
+class Channel; |
+class ServerCompletionQueue; |
+} // namespace grpc |
+ |
+namespace blimp { |
+ |
+// A |HeliumStream| that implements the gRPC bidirectional streaming API for the |
Garrett Casto
2016/11/11 00:15:53
Nit: Generally speaking pipes are for variable nam
|
+// client. |
+class BLIMP_NET_EXPORT GrpcClientStream : public GrpcStream { |
+ public: |
+ GrpcClientStream(const AssignmentOptions& assignment_options, |
+ const net::CompletionCallback& connection_callback); |
+ void SendMessage(std::unique_ptr<HeliumWrapper> helium_message, |
+ const Stream::SendMessageCallback& callback) override; |
+ void ReceiveMessage( |
+ const Stream::ReceiveMessageCallback& on_receive_cb) override; |
+ ~GrpcClientStream() override; |
+ |
+ protected: |
+ AssignmentOptions assignment_options_; |
+ |
+ // Data that is shared between the IO thread and the completion queue thread |
+ // specific to the client stream. See |GrpcStream::SharedData| and |
+ // |GrpcClientStream::SharedData| for more details. |
+ struct ClientSharedData; |
+ scoped_refptr<ClientSharedData> shared_data_; |
+ base::ThreadChecker thread_checker_; |
+}; |
+ |
+} // namespace blimp |
+ |
+#endif // BLIMP_NET_GRPC_CLIENT_STREAM_H_ |