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

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

Issue 2462183002: GRPC Stream implementation of HeliumStream
Patch Set: Implement helium::Stream 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_ENGINE_STREAM_H_
6 #define BLIMP_NET_GRPC_ENGINE_STREAM_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "blimp/net/blimp_net_export.h"
14 #include "blimp/net/blimp_transport.h"
15 #include "net/base/completion_callback.h"
16
17 #include <grpc++/security/server_credentials.h>
18 #include <grpc++/server.h>
19 #include <grpc++/server_builder.h>
20 #include <grpc++/server_context.h>
21 #include <grpc/grpc.h>
22
23 #include "base/callback.h"
24 #include "base/command_line.h"
25 #include "base/memory/ptr_util.h"
26 #include "base/synchronization/lock.h"
27 #include "base/threading/thread.h"
28 #include "blimp/common/logging.h"
29 #include "blimp/common/proto/blimp_message.pb.h"
30 #include "blimp/common/proto/helium_service.grpc.pb.h"
31 #include "blimp/net/blimp_message_processor.h"
32 #include "blimp/net/blimp_message_pump.h"
33 #include "blimp/net/grpc_connection.h"
34 #include "blimp/net/grpc_stream.h"
35
36 namespace grpc {
37 class Channel;
38 class ServerCompletionQueue;
39 } // namespace grpc
40
41 namespace blimp {
42
43 class GrpcEngineStream : public GrpcStream {
44 public:
45 GrpcEngineStream(const std::string& ip_address,
46 const net::CompletionCallback& connection_callback);
47
48 void SendMessage(std::unique_ptr<HeliumWrapper> helium_message,
49 const Stream::SendMessageCallback& callback) override;
50
51 void ReceiveMessage(
52 const Stream::ReceiveMessageCallback& on_receive_cb) override;
53
54 ~GrpcEngineStream() override;
55
56 private:
57 std::string ip_address_;
58 HeliumService::AsyncService service_;
59 std::unique_ptr<grpc::ServerCompletionQueue> completion_queue_;
60 std::unique_ptr<grpc::Server> server_;
61 grpc::ServerContext context_;
62 std::unique_ptr<grpc::ServerAsyncReaderWriter<HeliumWrapper, HeliumWrapper>>
63 stream_;
64 };
65
66 } // namespace blimp
67
68 #endif // BLIMP_NET_GRPC_ENGINE_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698