| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "google_apis/gcm/engine/connection_factory_impl.h" | 5 #include "google_apis/gcm/engine/connection_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
| 10 #include "google_apis/gcm/engine/connection_handler_impl.h" | 10 #include "google_apis/gcm/engine/connection_handler_impl.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 DCHECK(!socket_handle_.socket()); | 273 DCHECK(!socket_handle_.socket()); |
| 274 | 274 |
| 275 if (waiting_for_network_online_) | 275 if (waiting_for_network_online_) |
| 276 return; | 276 return; |
| 277 | 277 |
| 278 connecting_ = true; | 278 connecting_ = true; |
| 279 GURL current_endpoint = GetCurrentEndpoint(); | 279 GURL current_endpoint = GetCurrentEndpoint(); |
| 280 recorder_->RecordConnectionInitiated(current_endpoint.host()); | 280 recorder_->RecordConnectionInitiated(current_endpoint.host()); |
| 281 int status = network_session_->proxy_service()->ResolveProxy( | 281 int status = network_session_->proxy_service()->ResolveProxy( |
| 282 current_endpoint, | 282 current_endpoint, |
| 283 0, |
| 283 &proxy_info_, | 284 &proxy_info_, |
| 284 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, | 285 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, |
| 285 weak_ptr_factory_.GetWeakPtr()), | 286 weak_ptr_factory_.GetWeakPtr()), |
| 286 &pac_request_, | 287 &pac_request_, |
| 288 NULL, |
| 287 bound_net_log_); | 289 bound_net_log_); |
| 288 if (status != net::ERR_IO_PENDING) | 290 if (status != net::ERR_IO_PENDING) |
| 289 OnProxyResolveDone(status); | 291 OnProxyResolveDone(status); |
| 290 } | 292 } |
| 291 | 293 |
| 292 void ConnectionFactoryImpl::InitHandler() { | 294 void ConnectionFactoryImpl::InitHandler() { |
| 293 // May be null in tests. | 295 // May be null in tests. |
| 294 mcs_proto::LoginRequest login_request; | 296 mcs_proto::LoginRequest login_request; |
| 295 if (!request_builder_.is_null()) { | 297 if (!request_builder_.is_null()) { |
| 296 request_builder_.Run(&login_request); | 298 request_builder_.Run(&login_request); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 // the destroyed socket. | 535 // the destroyed socket. |
| 534 if (connection_handler_) | 536 if (connection_handler_) |
| 535 connection_handler_->Reset(); | 537 connection_handler_->Reset(); |
| 536 | 538 |
| 537 if (socket_handle_.socket() && socket_handle_.socket()->IsConnected()) | 539 if (socket_handle_.socket() && socket_handle_.socket()->IsConnected()) |
| 538 socket_handle_.socket()->Disconnect(); | 540 socket_handle_.socket()->Disconnect(); |
| 539 socket_handle_.Reset(); | 541 socket_handle_.Reset(); |
| 540 } | 542 } |
| 541 | 543 |
| 542 } // namespace gcm | 544 } // namespace gcm |
| OLD | NEW |