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

Side by Side Diff: blimp/net/grpc_client_stream.h

Issue 2462183002: GRPC Stream implementation of HeliumStream
Patch Set: 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 unified diff | Download patch
OLDNEW
(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 "base/callback.h"
9 #include "base/macros.h"
10 #include "blimp/net/blimp_net_export.h"
11 #include "blimp/net/blimp_transport.h"
12 #include "net/base/completion_callback.h"
13
14 #include <grpc++/security/server_credentials.h>
15 #include <grpc++/server.h>
16 #include <grpc++/server_builder.h>
17 #include <grpc++/server_context.h>
18 #include <grpc/grpc.h>
19
20 #include "base/callback.h"
21 #include "base/command_line.h"
22 #include "base/memory/ptr_util.h"
23 #include "base/synchronization/lock.h"
24 #include "base/threading/thread.h"
25 #include "blimp/common/logging.h"
26 #include "blimp/common/proto/blimp_message.pb.h"
27 #include "blimp/common/proto/helium_service.grpc.pb.h"
28 #include "blimp/net/blimp_message_processor.h"
29 #include "blimp/net/blimp_message_pump.h"
30 #include "blimp/net/grpc_connection.h"
31 #include "blimp/net/grpc_stream.h"
32
33 namespace grpc {
34 class Channel;
35 class ServerCompletionQueue;
36 } // namespace grpc
37
38 namespace blimp {
39
40 class GrpcClientStream : public GrpcStream {
41 public:
42 GrpcClientStream(const std::string& ip_address,
43 const net::CompletionCallback& connection_callback);
44
45 void SendMessage(std::unique_ptr<HeliumWrapper> helium_message,
46 const HeliumMessageSentCb& sent_cb) override;
47
48 void ReceiveMessage(const HeliumMessageReceivedCb& received_cb) override;
49
50 ~GrpcClientStream() override;
51
52 protected:
53 std::string ip_address_;
54 std::unique_ptr<HeliumService::Stub> stub_;
55 std::unique_ptr<grpc::CompletionQueue> completion_queue_;
56 grpc::ClientContext context_;
57 std::unique_ptr<grpc::ClientAsyncReaderWriter<HeliumWrapper, HeliumWrapper>>
58 stream_;
59 };
60
61 } // namespace blimp
62
63 #endif // BLIMP_NET_GRPC_CLIENT_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698