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

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

Issue 2439403003: Refactor BlimpConnection to TCPConnection (Closed)
Patch Set: Added missing Engine Transport 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"
16 #include "net/log/net_log.h"
15 17
16 namespace blimp { 18 namespace blimp {
17 19
18 class BlimpConnection; 20 class BlimpConnection;
19 class BlimpTransport; 21 class BlimpTransport;
22 class BlimpEngineTransport;
20 23
21 // Coordinates the channel creation and authentication workflows for 24 // Coordinates the channel creation and authentication workflows for
22 // incoming (Engine) network connections. 25 // incoming (Engine) network connections.
23 // 26 //
24 // TODO(kmarshall): Add rate limiting and abuse handling logic. 27 // TODO(kmarshall): Add rate limiting and abuse handling logic.
25 class BLIMP_NET_EXPORT EngineConnectionManager { 28 class BLIMP_NET_EXPORT EngineConnectionManager {
Wez 2016/11/09 22:47:17 This class, as per the comment, was intended to be
perumaal 2016/11/10 02:05:05 Kevin and I talked about this specifically. One co
26 public: 29 public:
30 enum class EngineTransportType { TCP, GRPC };
31
27 // Caller is responsible for ensuring that |connection_handler| outlives 32 // Caller is responsible for ensuring that |connection_handler| outlives
28 // |this|. 33 // |this|.
29 explicit EngineConnectionManager(ConnectionHandler* connection_handler); 34 explicit EngineConnectionManager(ConnectionHandler* connection_handler,
35 net::NetLog* net_log);
30 36
31 ~EngineConnectionManager(); 37 ~EngineConnectionManager();
32 38
33 // Adds a transport and accepts new BlimpConnections from it as fast as they 39 // Adds a transport and accepts new BlimpConnections from it as fast as they
34 // arrive. 40 // arrive. The |ip_endpoint| will receive the actual port-number if the
35 void AddTransport(std::unique_ptr<BlimpTransport> transport); 41 // provided one is not available for listening.
42 void ConnectTransport(net::IPEndPoint* ip_endpoint,
Wez 2016/11/09 22:47:17 Let's not have in/out parameters. We can add a ge
perumaal 2016/11/10 02:05:05 I had it that way actually initially. The problem
43 EngineTransportType transport_type);
36 44
37 private: 45 private:
38 // Invokes transport->Connect to listen for a connection.
39 void Connect(BlimpTransport* transport);
40
41 // Callback invoked by |transport| to indicate that it has a connection 46 // Callback invoked by |transport| to indicate that it has a connection
42 // ready to be authenticated. 47 // ready to be authenticated.
43 void OnConnectResult(BlimpTransport* transport, int result); 48 void OnConnectResult(BlimpTransport* transport, int result);
44 49
45 ConnectionHandler* connection_handler_; 50 ConnectionHandler* connection_handler_;
46 std::vector<std::unique_ptr<BlimpTransport>> transports_; 51 net::NetLog* net_log_;
52 std::unique_ptr<BlimpEngineTransport> transport_;
47 53
48 DISALLOW_COPY_AND_ASSIGN(EngineConnectionManager); 54 DISALLOW_COPY_AND_ASSIGN(EngineConnectionManager);
49 }; 55 };
50 56
51 } // namespace blimp 57 } // namespace blimp
52 58
53 #endif // BLIMP_NET_ENGINE_CONNECTION_MANAGER_H_ 59 #endif // BLIMP_NET_ENGINE_CONNECTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698