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

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

Issue 2439403003: Refactor BlimpConnection to TCPConnection (Closed)
Patch Set: Sync merge 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_address.h"
Garrett Casto 2016/10/25 18:33:50 Doesn't look like this is used.
perumaal 2016/10/25 23:02:39 How do I check for unnecessary includes using git
16 #include "net/base/ip_endpoint.h"
17 #include "net/base/net_errors.h"
Garrett Casto 2016/10/25 18:33:50 Or this.
perumaal 2016/10/25 23:02:39 Done.
18 #include "net/log/net_log.h"
15 19
16 namespace blimp { 20 namespace blimp {
17 21
18 class BlimpConnection; 22 class BlimpConnection;
19 class BlimpTransport; 23 class BlimpTransport;
20 24
21 // Coordinates the channel creation and authentication workflows for 25 // Coordinates the channel creation and authentication workflows for
22 // incoming (Engine) network connections. 26 // incoming (Engine) network connections.
23 // 27 //
24 // TODO(kmarshall): Add rate limiting and abuse handling logic. 28 // TODO(kmarshall): Add rate limiting and abuse handling logic.
25 class BLIMP_NET_EXPORT EngineConnectionManager { 29 class BLIMP_NET_EXPORT EngineConnectionManager {
26 public: 30 public:
31 enum class EngineTransportType { TCP, GRPC };
32
27 // Caller is responsible for ensuring that |connection_handler| outlives 33 // Caller is responsible for ensuring that |connection_handler| outlives
28 // |this|. 34 // |this|.
29 explicit EngineConnectionManager(ConnectionHandler* connection_handler); 35 explicit EngineConnectionManager(ConnectionHandler* connection_handler,
36 net::NetLog* net_log);
30 37
31 ~EngineConnectionManager(); 38 ~EngineConnectionManager();
32 39
33 // 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
34 // arrive. 41 // arrive.
35 void AddTransport(std::unique_ptr<BlimpTransport> transport); 42 void ConnectTransport(const net::IPEndPoint& ip_endpoint,
Kevin M 2016/10/25 18:49:23 Suggestion: just take a std::unique_ptr<BlimpTrans
perumaal 2016/10/25 23:02:39 I would really like the EngineConnectionManager to
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<BlimpTransport> 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