Index: blimp/net/grpc_engine_stream.h |
diff --git a/blimp/net/grpc_engine_stream.h b/blimp/net/grpc_engine_stream.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f4b9824433a7a17ea5ce5784c32d5d4a1a00a2ff |
--- /dev/null |
+++ b/blimp/net/grpc_engine_stream.h |
@@ -0,0 +1,54 @@ |
+// 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_ENGINE_STREAM_H_ |
+#define BLIMP_NET_GRPC_ENGINE_STREAM_H_ |
+ |
+#include <memory> |
+ |
+#include "base/command_line.h" |
+#include "base/threading/thread_checker.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 { |
+ |
+class HeliumWrapper; |
+ |
+// A HeliumStream that implements the gRPC bidirectional streaming API for the |
+// engine. |
+class BLIMP_NET_EXPORT GrpcEngineStream : public GrpcStream { |
+ public: |
+ GrpcEngineStream(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; |
+ const AssignmentOptions& GetAssignmentOptions() const; |
+ ~GrpcEngineStream() override; |
+ |
+ private: |
+ AssignmentOptions assignment_options_; |
+ |
+ // Data that is shared between the IO thread and the completion queue thread |
+ // specific to the engine stream. See GrpcStream::SharedData and |
+ // GrpcEngineStream::SharedData for more details. |
+ struct EngineSharedData; |
+ scoped_refptr<EngineSharedData> shared_data_; |
+ base::ThreadChecker thread_checker_; |
+}; |
+ |
+} // namespace blimp |
+ |
+#endif // BLIMP_NET_GRPC_ENGINE_STREAM_H_ |