OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ |
6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 virtual scoped_ptr<base::Clock> BuildClock(); | 60 virtual scoped_ptr<base::Clock> BuildClock(); |
61 virtual scoped_ptr<MCSClient> BuildMCSClient( | 61 virtual scoped_ptr<MCSClient> BuildMCSClient( |
62 const std::string& version, | 62 const std::string& version, |
63 base::Clock* clock, | 63 base::Clock* clock, |
64 ConnectionFactory* connection_factory, | 64 ConnectionFactory* connection_factory, |
65 GCMStore* gcm_store, | 65 GCMStore* gcm_store, |
66 GCMStatsRecorder* recorder); | 66 GCMStatsRecorder* recorder); |
67 virtual scoped_ptr<ConnectionFactory> BuildConnectionFactory( | 67 virtual scoped_ptr<ConnectionFactory> BuildConnectionFactory( |
68 const std::vector<GURL>& endpoints, | 68 const std::vector<GURL>& endpoints, |
69 const net::BackoffEntry::Policy& backoff_policy, | 69 const net::BackoffEntry::Policy& backoff_policy, |
70 const scoped_refptr<net::HttpNetworkSession>& gcm_network_session, | 70 net::HttpNetworkSession* gcm_network_session, |
71 const scoped_refptr<net::HttpNetworkSession>& http_network_session, | 71 net::HttpNetworkSession* http_network_session, |
72 net::NetLog* net_log, | 72 net::NetLog* net_log, |
73 GCMStatsRecorder* recorder); | 73 GCMStatsRecorder* recorder); |
74 }; | 74 }; |
75 | 75 |
76 // Implements the GCM Client. It is used to coordinate MCS Client (communication | 76 // Implements the GCM Client. It is used to coordinate MCS Client (communication |
77 // with MCS) and other pieces of GCM infrastructure like Registration and | 77 // with MCS) and other pieces of GCM infrastructure like Registration and |
78 // Checkins. It also allows for registering user delegates that host | 78 // Checkins. It also allows for registering user delegates that host |
79 // applications that send and receive messages. | 79 // applications that send and receive messages. |
80 class GCMClientImpl | 80 class GCMClientImpl |
81 : public GCMClient, public GCMStatsRecorder::Delegate, | 81 : public GCMClient, public GCMStatsRecorder::Delegate, |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // serial number mappings. | 329 // serial number mappings. |
330 scoped_ptr<GCMStore> gcm_store_; | 330 scoped_ptr<GCMStore> gcm_store_; |
331 | 331 |
332 // Data loaded from the GCM store. | 332 // Data loaded from the GCM store. |
333 scoped_ptr<GCMStore::LoadResult> load_result_; | 333 scoped_ptr<GCMStore::LoadResult> load_result_; |
334 | 334 |
335 // Tracks if the GCM store has been reset. This is used to prevent from | 335 // Tracks if the GCM store has been reset. This is used to prevent from |
336 // resetting and loading from the store again and again. | 336 // resetting and loading from the store again and again. |
337 bool gcm_store_reset_; | 337 bool gcm_store_reset_; |
338 | 338 |
339 scoped_refptr<net::HttpNetworkSession> network_session_; | 339 scoped_ptr<net::HttpNetworkSession> network_session_; |
340 net::BoundNetLog net_log_; | |
341 scoped_ptr<ConnectionFactory> connection_factory_; | 340 scoped_ptr<ConnectionFactory> connection_factory_; |
342 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 341 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
343 | 342 |
344 // Controls receiving and sending of packets and reliable message queueing. | 343 // Controls receiving and sending of packets and reliable message queueing. |
| 344 // Must be destroyed before |network_session_|. |
345 scoped_ptr<MCSClient> mcs_client_; | 345 scoped_ptr<MCSClient> mcs_client_; |
346 | 346 |
347 scoped_ptr<CheckinRequest> checkin_request_; | 347 scoped_ptr<CheckinRequest> checkin_request_; |
348 | 348 |
349 // Cached registration info. | 349 // Cached registration info. |
350 RegistrationInfoMap registrations_; | 350 RegistrationInfoMap registrations_; |
351 | 351 |
352 // Currently pending registration requests. GCMClientImpl owns the | 352 // Currently pending registration requests. GCMClientImpl owns the |
353 // RegistrationRequests. | 353 // RegistrationRequests. |
354 PendingRegistrationRequests pending_registration_requests_; | 354 PendingRegistrationRequests pending_registration_requests_; |
(...skipping 20 matching lines...) Expand all Loading... |
375 | 375 |
376 // Factory for creating references in callbacks. | 376 // Factory for creating references in callbacks. |
377 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 377 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
378 | 378 |
379 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 379 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
380 }; | 380 }; |
381 | 381 |
382 } // namespace gcm | 382 } // namespace gcm |
383 | 383 |
384 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ | 384 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ |
OLD | NEW |