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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 waiting_for_backoff_(false), | 59 waiting_for_backoff_(false), |
60 waiting_for_network_online_(false), | 60 waiting_for_network_online_(false), |
61 logging_in_(false), | 61 logging_in_(false), |
62 recorder_(recorder), | 62 recorder_(recorder), |
63 listener_(NULL), | 63 listener_(NULL), |
64 weak_ptr_factory_(this) { | 64 weak_ptr_factory_(this) { |
65 DCHECK_GE(mcs_endpoints_.size(), 1U); | 65 DCHECK_GE(mcs_endpoints_.size(), 1U); |
66 } | 66 } |
67 | 67 |
68 ConnectionFactoryImpl::~ConnectionFactoryImpl() { | 68 ConnectionFactoryImpl::~ConnectionFactoryImpl() { |
| 69 CloseSocket(); |
69 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); | 70 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); |
70 if (pac_request_) { | 71 if (pac_request_) { |
71 network_session_->proxy_service()->CancelPacRequest(pac_request_); | 72 network_session_->proxy_service()->CancelPacRequest(pac_request_); |
72 pac_request_ = NULL; | 73 pac_request_ = NULL; |
73 } | 74 } |
74 } | 75 } |
75 | 76 |
76 void ConnectionFactoryImpl::Initialize( | 77 void ConnectionFactoryImpl::Initialize( |
77 const BuildLoginRequestCallback& request_builder, | 78 const BuildLoginRequestCallback& request_builder, |
78 const ConnectionHandler::ProtoReceivedCallback& read_callback, | 79 const ConnectionHandler::ProtoReceivedCallback& read_callback, |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 // the destroyed socket. | 534 // the destroyed socket. |
534 if (connection_handler_) | 535 if (connection_handler_) |
535 connection_handler_->Reset(); | 536 connection_handler_->Reset(); |
536 | 537 |
537 if (socket_handle_.socket() && socket_handle_.socket()->IsConnected()) | 538 if (socket_handle_.socket() && socket_handle_.socket()->IsConnected()) |
538 socket_handle_.socket()->Disconnect(); | 539 socket_handle_.socket()->Disconnect(); |
539 socket_handle_.Reset(); | 540 socket_handle_.Reset(); |
540 } | 541 } |
541 | 542 |
542 } // namespace gcm | 543 } // namespace gcm |
OLD | NEW |