OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BLIMP_NET_GRPC_ENGINE_STREAM_H_ |
| 6 #define BLIMP_NET_GRPC_ENGINE_STREAM_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/command_line.h" |
| 11 #include "base/threading/thread_checker.h" |
| 12 |
| 13 #include "blimp/common/public/session/assignment_options.h" |
| 14 #include "blimp/net/blimp_net_export.h" |
| 15 #include "blimp/net/grpc_stream.h" |
| 16 |
| 17 #include "net/base/completion_callback.h" |
| 18 |
| 19 namespace grpc { |
| 20 class Channel; |
| 21 class ServerCompletionQueue; |
| 22 } // namespace grpc |
| 23 |
| 24 namespace blimp { |
| 25 |
| 26 class HeliumWrapper; |
| 27 |
| 28 // A HeliumStream that implements the gRPC bidirectional streaming API for the |
| 29 // engine. |
| 30 class BLIMP_NET_EXPORT GrpcEngineStream : public GrpcStream { |
| 31 public: |
| 32 GrpcEngineStream(const AssignmentOptions& assignment_options, |
| 33 const net::CompletionCallback& connection_callback); |
| 34 void SendMessage(std::unique_ptr<HeliumWrapper> helium_message, |
| 35 const Stream::SendMessageCallback& callback) override; |
| 36 void ReceiveMessage( |
| 37 const Stream::ReceiveMessageCallback& on_receive_cb) override; |
| 38 const AssignmentOptions& GetAssignmentOptions() const; |
| 39 ~GrpcEngineStream() override; |
| 40 |
| 41 private: |
| 42 AssignmentOptions assignment_options_; |
| 43 |
| 44 // Data that is shared between the IO thread and the completion queue thread |
| 45 // specific to the engine stream. See GrpcStream::SharedData and |
| 46 // GrpcEngineStream::SharedData for more details. |
| 47 struct EngineSharedData; |
| 48 scoped_refptr<EngineSharedData> shared_data_; |
| 49 base::ThreadChecker thread_checker_; |
| 50 }; |
| 51 |
| 52 } // namespace blimp |
| 53 |
| 54 #endif // BLIMP_NET_GRPC_ENGINE_STREAM_H_ |
OLD | NEW |