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

Unified Diff: blimp/net/grpc_engine_stream.h

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_connection_unittest.cc ('k') | blimp/net/grpc_engine_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « blimp/net/grpc_connection_unittest.cc ('k') | blimp/net/grpc_engine_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698