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_CLIENT_STREAM_H_ | |
6 #define BLIMP_NET_GRPC_CLIENT_STREAM_H_ | |
7 | |
8 #include <grpc++/security/server_credentials.h> | |
9 #include <grpc++/server.h> | |
10 #include <grpc++/server_builder.h> | |
11 #include <grpc++/server_context.h> | |
12 #include <grpc/grpc.h> | |
Garrett Casto
2016/11/11 00:15:53
Nit: We may want to have a discussion on how we re
| |
13 | |
14 #include <memory> | |
15 | |
16 #include "base/callback.h" | |
17 #include "base/threading/thread_checker.h" | |
18 | |
19 #include "blimp/common/assignment_options.h" | |
20 #include "blimp/common/logging.h" | |
21 #include "blimp/common/proto/helium_service.grpc.pb.h" | |
22 #include "blimp/net/blimp_net_export.h" | |
23 #include "blimp/net/grpc_stream.h" | |
24 | |
25 #include "net/base/completion_callback.h" | |
26 | |
27 namespace grpc { | |
28 class Channel; | |
29 class ServerCompletionQueue; | |
30 } // namespace grpc | |
31 | |
32 namespace blimp { | |
33 | |
34 // 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
| |
35 // client. | |
36 class BLIMP_NET_EXPORT GrpcClientStream : public GrpcStream { | |
37 public: | |
38 GrpcClientStream(const AssignmentOptions& assignment_options, | |
39 const net::CompletionCallback& connection_callback); | |
40 void SendMessage(std::unique_ptr<HeliumWrapper> helium_message, | |
41 const Stream::SendMessageCallback& callback) override; | |
42 void ReceiveMessage( | |
43 const Stream::ReceiveMessageCallback& on_receive_cb) override; | |
44 ~GrpcClientStream() override; | |
45 | |
46 protected: | |
47 AssignmentOptions assignment_options_; | |
48 | |
49 // Data that is shared between the IO thread and the completion queue thread | |
50 // specific to the client stream. See |GrpcStream::SharedData| and | |
51 // |GrpcClientStream::SharedData| for more details. | |
52 struct ClientSharedData; | |
53 scoped_refptr<ClientSharedData> shared_data_; | |
54 base::ThreadChecker thread_checker_; | |
55 }; | |
56 | |
57 } // namespace blimp | |
58 | |
59 #endif // BLIMP_NET_GRPC_CLIENT_STREAM_H_ | |
OLD | NEW |