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 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ |
6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ |
7 | 7 |
8 #include "google_apis/gcm/engine/connection_factory.h" | 8 #include "google_apis/gcm/engine/connection_factory.h" |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "google_apis/gcm/engine/connection_handler.h" |
12 #include "google_apis/gcm/protocol/mcs.pb.h" | 13 #include "google_apis/gcm/protocol/mcs.pb.h" |
13 #include "net/base/backoff_entry.h" | 14 #include "net/base/backoff_entry.h" |
14 #include "net/base/network_change_notifier.h" | 15 #include "net/base/network_change_notifier.h" |
15 #include "net/proxy/proxy_info.h" | 16 #include "net/proxy/proxy_info.h" |
16 #include "net/proxy/proxy_service.h" | 17 #include "net/proxy/proxy_service.h" |
17 #include "net/socket/client_socket_handle.h" | 18 #include "net/socket/client_socket_handle.h" |
18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
19 | 20 |
20 namespace net { | 21 namespace net { |
21 class HttpNetworkSession; | 22 class HttpNetworkSession; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 168 |
168 // Whether login successfully completed after the connection was established. | 169 // Whether login successfully completed after the connection was established. |
169 // If a connection reset happens while attempting to log in, the current | 170 // If a connection reset happens while attempting to log in, the current |
170 // backoff entry is reused (after incrementing with a new failure). | 171 // backoff entry is reused (after incrementing with a new failure). |
171 bool logging_in_; | 172 bool logging_in_; |
172 | 173 |
173 // The time of the last login completion. Used for calculating whether to | 174 // The time of the last login completion. Used for calculating whether to |
174 // restore a previous backoff entry and for measuring uptime. | 175 // restore a previous backoff entry and for measuring uptime. |
175 base::TimeTicks last_login_time_; | 176 base::TimeTicks last_login_time_; |
176 | 177 |
| 178 // Cached callbacks. Set at |Initialize| time, consumed at first |Connect| |
| 179 // time. |
| 180 ConnectionHandler::ProtoReceivedCallback read_callback_; |
| 181 ConnectionHandler::ProtoSentCallback write_callback_; |
| 182 |
177 // The current connection handler, if one exists. | 183 // The current connection handler, if one exists. |
178 scoped_ptr<ConnectionHandler> connection_handler_; | 184 scoped_ptr<ConnectionHandler> connection_handler_; |
179 | 185 |
180 // Builder for generating new login requests. | 186 // Builder for generating new login requests. |
181 BuildLoginRequestCallback request_builder_; | 187 BuildLoginRequestCallback request_builder_; |
182 | 188 |
183 // Recorder that records GCM activities for debugging purpose. Not owned. | 189 // Recorder that records GCM activities for debugging purpose. Not owned. |
184 GCMStatsRecorder* recorder_; | 190 GCMStatsRecorder* recorder_; |
185 | 191 |
186 // Listener for connection change events. | 192 // Listener for connection change events. |
187 ConnectionListener* listener_; | 193 ConnectionListener* listener_; |
188 | 194 |
189 base::WeakPtrFactory<ConnectionFactoryImpl> weak_ptr_factory_; | 195 base::WeakPtrFactory<ConnectionFactoryImpl> weak_ptr_factory_; |
190 | 196 |
191 DISALLOW_COPY_AND_ASSIGN(ConnectionFactoryImpl); | 197 DISALLOW_COPY_AND_ASSIGN(ConnectionFactoryImpl); |
192 }; | 198 }; |
193 | 199 |
194 } // namespace gcm | 200 } // namespace gcm |
195 | 201 |
196 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ | 202 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ |
OLD | NEW |