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_CHANNEL_STATUS_SYNCER_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_SYNCER_H_ |
6 #define COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_SYNCER_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_SYNCER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void set_delay_removed_for_testing(bool delay_removed) { | 52 void set_delay_removed_for_testing(bool delay_removed) { |
53 delay_removed_for_testing_ = delay_removed; | 53 delay_removed_for_testing_ = delay_removed; |
54 } | 54 } |
55 base::TimeDelta current_request_delay_interval() const { | 55 base::TimeDelta current_request_delay_interval() const { |
56 return current_request_delay_interval_; | 56 return current_request_delay_interval_; |
57 } | 57 } |
58 static int first_time_delay_seconds(); | 58 static int first_time_delay_seconds(); |
59 | 59 |
60 private: | 60 private: |
61 // Called when a request is completed. | 61 // Called when a request is completed. |
62 void OnRequestCompleted(bool update_received, | 62 void OnRequestCompleted(bool enabled, int poll_interval_seconds); |
63 bool enabled, | |
64 int poll_interval_seconds); | |
65 | 63 |
66 // Schedules next request to start after appropriate delay. | 64 // Schedules next request to start after appropriate delay. |
67 void ScheduleRequest(); | 65 void ScheduleRequest(); |
68 | 66 |
69 // Creates and starts a request immediately. | 67 // Creates and starts a request immediately. |
70 void StartRequest(); | 68 void StartRequest(); |
71 | 69 |
72 // Computes and returns a delay with the fuzzing variation added if needed, | 70 // Computes and returns a delay with the fuzzing variation added if needed, |
73 // after which the request could start. | 71 // after which the request could start. |
74 base::TimeDelta GetRequestDelayInterval() const; | 72 base::TimeDelta GetRequestDelayInterval() const; |
(...skipping 20 matching lines...) Expand all Loading... |
95 | 93 |
96 // Used to pass a weak pointer to a task. | 94 // Used to pass a weak pointer to a task. |
97 base::WeakPtrFactory<GCMChannelStatusSyncer> weak_ptr_factory_; | 95 base::WeakPtrFactory<GCMChannelStatusSyncer> weak_ptr_factory_; |
98 | 96 |
99 DISALLOW_COPY_AND_ASSIGN(GCMChannelStatusSyncer); | 97 DISALLOW_COPY_AND_ASSIGN(GCMChannelStatusSyncer); |
100 }; | 98 }; |
101 | 99 |
102 } // namespace gcm | 100 } // namespace gcm |
103 | 101 |
104 #endif // COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_SYNCER_H_ | 102 #endif // COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_SYNCER_H_ |
OLD | NEW |