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..6b11a68d1cce9951c5d0d3d1bd66cd03cfbcca57 |
--- /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> |
+ |
+#include <memory> |
+ |
+#include "base/callback.h" |
+#include "base/threading/thread_checker.h" |
+ |
+#include "blimp/common/logging.h" |
+#include "blimp/common/proto/helium_service.grpc.pb.h" |
+#include "blimp/common/public/session/assignment_options.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 |
+// 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_ |