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

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

Issue 2462183002: GRPC Stream implementation of HeliumStream
Patch Set: Fixed a few minor 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BLIMP_NET_ENGINE_CONNECTION_MANAGER_H_ 5 #ifndef BLIMP_NET_ENGINE_CONNECTION_MANAGER_H_
6 #define BLIMP_NET_ENGINE_CONNECTION_MANAGER_H_ 6 #define BLIMP_NET_ENGINE_CONNECTION_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "blimp/net/blimp_net_export.h" 13 #include "blimp/net/blimp_net_export.h"
14 #include "blimp/net/connection_handler.h" 14 #include "blimp/net/connection_handler.h"
15 #include "net/base/ip_endpoint.h" 15 #include "net/base/ip_endpoint.h"
16 #include "net/log/net_log.h" 16 #include "net/log/net_log.h"
17 17
18 namespace blimp { 18 namespace blimp {
19 19
20 struct AssignmentOptions;
20 class BlimpConnection; 21 class BlimpConnection;
21 class BlimpTransport; 22 class BlimpTransport;
22 class BlimpEngineTransport; 23 class BlimpEngineTransport;
23 24
24 // Coordinates the channel creation and authentication workflows for 25 // Coordinates the channel creation and authentication workflows for
25 // incoming (Engine) network connections. 26 // incoming (Engine) network connections.
26 // 27 //
27 // TODO(kmarshall): Add rate limiting and abuse handling logic. 28 // TODO(kmarshall): Add rate limiting and abuse handling logic.
28 class BLIMP_NET_EXPORT EngineConnectionManager { 29 class BLIMP_NET_EXPORT EngineConnectionManager {
29 public: 30 public:
30 enum class EngineTransportType { TCP, GRPC }; 31 enum class EngineTransportType { TCP, GRPC };
31 32
32 // Caller is responsible for ensuring that |connection_handler| outlives 33 // Caller is responsible for ensuring that |connection_handler| outlives
33 // |this|. 34 // |this|.
34 explicit EngineConnectionManager(ConnectionHandler* connection_handler, 35 explicit EngineConnectionManager(ConnectionHandler* connection_handler,
35 net::NetLog* net_log); 36 net::NetLog* net_log);
36 37
37 ~EngineConnectionManager(); 38 ~EngineConnectionManager();
38 39
39 // Adds a transport and accepts new BlimpConnections from it as fast as they 40 // Adds a transport and accepts new BlimpConnections from it as fast as they
40 // arrive. The |ip_endpoint| will receive the actual port-number if the 41 // arrive. The |ip_endpoint| will receive the actual port-number if the
41 // provided one is not available for listening. 42 // provided one is not available for listening.
42 void ConnectTransport(net::IPEndPoint* ip_endpoint, 43 void ConnectTransport(AssignmentOptions* assignment_options,
43 EngineTransportType transport_type); 44 EngineTransportType transport_type);
44 45
45 private: 46 private:
46 // Callback invoked by |transport| to indicate that it has a connection 47 // Callback invoked by |transport| to indicate that it has a connection
47 // ready to be authenticated. 48 // ready to be authenticated.
48 void OnConnectResult(BlimpTransport* transport, int result); 49 void OnConnectResult(BlimpTransport* transport, int result);
49 50
50 ConnectionHandler* connection_handler_; 51 ConnectionHandler* connection_handler_;
51 net::NetLog* net_log_; 52 net::NetLog* net_log_;
52 std::unique_ptr<BlimpEngineTransport> transport_; 53 std::unique_ptr<BlimpEngineTransport> transport_;
53 54
54 DISALLOW_COPY_AND_ASSIGN(EngineConnectionManager); 55 DISALLOW_COPY_AND_ASSIGN(EngineConnectionManager);
55 }; 56 };
56 57
57 } // namespace blimp 58 } // namespace blimp
58 59
59 #endif // BLIMP_NET_ENGINE_CONNECTION_MANAGER_H_ 60 #endif // BLIMP_NET_ENGINE_CONNECTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698