diff options
author | Jian Li <jianli@chromium.org> | 2014-10-15 22:53:56 -0700 |
---|---|---|
committer | Jian Li <jianli@chromium.org> | 2014-10-16 05:54:48 +0000 |
commit | 74eadb07fbefe7b883b8d8056dd3e029ff45b088 (patch) | |
tree | f19fef03897ad815e9979b82beb60a45c3c74fd3 /components/gcm_driver/gcm_channel_status_syncer.h | |
parent | 094e637503ebe258c4c94f67bd45939f9fbf51bd (diff) | |
download | chromium_src-74eadb07fbefe7b883b8d8056dd3e029ff45b088.zip chromium_src-74eadb07fbefe7b883b8d8056dd3e029ff45b088.tar.gz chromium_src-74eadb07fbefe7b883b8d8056dd3e029ff45b088.tar.bz2 |
[GCM] Start GCMChannelStatusSyncer when GCM is disabled
We need to start GCMChannelStatusSyncer when GCM is disabled in order
to poll the server to find out when it is reenabled.
Also if server returns empty response, we should not treat it as error
and trigger the backoff logic.
BUG=423415
TEST=new tests added
Committed: https://crrev.com/9e9dd3b7798b3500d70941af04b1325ef9a0b544
Cr-Commit-Position: refs/heads/master@{#299518}
R=fgorski@chromium.org
Review URL: https://codereview.chromium.org/653843003
Cr-Commit-Position: refs/heads/master@{#299854}
Diffstat (limited to 'components/gcm_driver/gcm_channel_status_syncer.h')
-rw-r--r-- | components/gcm_driver/gcm_channel_status_syncer.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/components/gcm_driver/gcm_channel_status_syncer.h b/components/gcm_driver/gcm_channel_status_syncer.h index b4641af..0b7ba3f 100644 --- a/components/gcm_driver/gcm_channel_status_syncer.h +++ b/components/gcm_driver/gcm_channel_status_syncer.h @@ -59,7 +59,9 @@ class GCMChannelStatusSyncer { private: // Called when a request is completed. - void OnRequestCompleted(bool enabled, int poll_interval_seconds); + void OnRequestCompleted(bool update_received, + bool enabled, + int poll_interval_seconds); // Schedules next request to start after appropriate delay. void ScheduleRequest(); @@ -80,10 +82,17 @@ class GCMChannelStatusSyncer { scoped_refptr<net::URLRequestContextGetter> request_context_; scoped_ptr<GCMChannelStatusRequest> request_; + bool started_; bool gcm_enabled_; int poll_interval_seconds_; base::Time last_check_time_; + // If non-zero, |poll_interval_seconds_| is overriden by the command line + // options for testing purpose. Each time when the custom poll interval is + // used, this count is subtracted by one. When it reaches zero, the default + // poll interval will be used instead. + int custom_poll_interval_use_count_; + // The flag that indicates if the delay, including fuzzing variation and poll // interval, is removed for testing purpose. bool delay_removed_for_testing_; |