Revert of [GCM] Start GCMChannelStatusSyncer when GCM is disabled (patchset #2 id:20001 of https://codereview.chromium.org/653843003/)
Reason for revert:
Reverted due to that the fix is not complete. Will fix one more issue we find and reland the patch.
Original issue's description:
> [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}
[email protected]
NOTREECHECKS=true
NOTRY=true
BUG=423415
Review URL: https://codereview.chromium.org/657703002
Cr-Commit-Position: refs/heads/master@{#299579}
diff --git a/components/gcm_driver/gcm_channel_status_syncer.cc b/components/gcm_driver/gcm_channel_status_syncer.cc
index 4be2eae..443c90d5 100644
--- a/components/gcm_driver/gcm_channel_status_syncer.cc
+++ b/components/gcm_driver/gcm_channel_status_syncer.cc
@@ -111,8 +111,7 @@
weak_ptr_factory_.InvalidateWeakPtrs();
}
-void GCMChannelStatusSyncer::OnRequestCompleted(bool update_received,
- bool enabled,
+void GCMChannelStatusSyncer::OnRequestCompleted(bool enabled,
int poll_interval_seconds) {
DCHECK(request_);
request_.reset();
@@ -122,23 +121,20 @@
prefs_->SetInt64(kGCMChannelLastCheckTime,
last_check_time_.ToInternalValue());
- if (update_received) {
- if (gcm_enabled_ != enabled) {
- gcm_enabled_ = enabled;
- prefs_->SetBoolean(kGCMChannelStatus, enabled);
- if (gcm_enabled_)
- driver_->Enable();
- else
- driver_->Disable();
- }
+ if (gcm_enabled_ != enabled) {
+ gcm_enabled_ = enabled;
+ prefs_->SetBoolean(kGCMChannelStatus, enabled);
+ if (gcm_enabled_)
+ driver_->Enable();
+ else
+ driver_->Disable();
+ }
- DCHECK_GE(poll_interval_seconds,
- GCMChannelStatusRequest::min_poll_interval_seconds());
- if (poll_interval_seconds_ != poll_interval_seconds) {
- poll_interval_seconds_ = poll_interval_seconds;
- prefs_->SetInteger(kGCMChannelPollIntervalSeconds,
- poll_interval_seconds_);
- }
+ DCHECK_GE(poll_interval_seconds,
+ GCMChannelStatusRequest::min_poll_interval_seconds());
+ if (poll_interval_seconds_ != poll_interval_seconds) {
+ poll_interval_seconds_ = poll_interval_seconds;
+ prefs_->SetInteger(kGCMChannelPollIntervalSeconds, poll_interval_seconds_);
}
ScheduleRequest();