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

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

Issue 2632803002: Remove all blimp network code. (Closed)
Patch Set: merge from origin/master for good measure Created 3 years, 11 months 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
« no previous file with comments | « blimp/net/engine_connection_manager.h ('k') | blimp/net/engine_connection_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "blimp/net/engine_connection_manager.h"
6
7 #include <utility>
8
9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h"
11 #include "blimp/net/blimp_connection.h"
12 #include "blimp/net/blimp_transport.h"
13 #include "blimp/net/message_port.h"
14 #include "blimp/net/tcp_engine_transport.h"
15 #include "net/base/ip_address.h"
16 #include "net/base/net_errors.h"
17
18 namespace blimp {
19
20 EngineConnectionManager::EngineConnectionManager(
21 ConnectionHandler* connection_handler,
22 net::NetLog* net_log)
23 : connection_handler_(connection_handler), net_log_(net_log) {
24 DCHECK(connection_handler_);
25 }
26
27 EngineConnectionManager::~EngineConnectionManager() {}
28
29 void EngineConnectionManager::ConnectTransport(
30 net::IPEndPoint* ip_endpoint,
31 EngineTransportType transport_type) {
32 switch (transport_type) {
33 case EngineTransportType::TCP: {
34 transport_ = base::MakeUnique<TCPEngineTransport>(*ip_endpoint, net_log_);
35 break;
36 }
37
38 case EngineTransportType::GRPC: {
39 NOTIMPLEMENTED();
40 // TODO(perumaal): Unimplemented as yet.
41 // transport_ =
42 // base::MakeUnique<GrpcEngineTransport>(ip_endpoint.ToString());
43 break;
44 }
45 }
46
47 Connect();
48 transport_->GetLocalAddress(ip_endpoint);
49 }
50
51 void EngineConnectionManager::Connect() {
52 transport_->Connect(base::Bind(&EngineConnectionManager::OnConnectResult,
53 base::Unretained(this)));
54 }
55
56 void EngineConnectionManager::OnConnectResult(int result) {
57 CHECK_EQ(net::OK, result) << "Transport failure:" << transport_->GetName();
58 connection_handler_->HandleConnection(transport_->MakeConnection());
59 Connect();
60 }
61
62 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/net/engine_connection_manager.h ('k') | blimp/net/engine_connection_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698