OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/sync/engine/sync_scheduler.h" | 5 #include "chrome/browser/sync/engine/sync_scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 poll != poll_timer_.GetCurrentDelay(); | 894 poll != poll_timer_.GetCurrentDelay(); |
895 | 895 |
896 if (old_job && old_job->purpose != SyncSessionJob::POLL && !rate_changed) | 896 if (old_job && old_job->purpose != SyncSessionJob::POLL && !rate_changed) |
897 poll_timer_.Reset(); | 897 poll_timer_.Reset(); |
898 | 898 |
899 if (!rate_changed) | 899 if (!rate_changed) |
900 return; | 900 return; |
901 | 901 |
902 // Adjust poll rate. | 902 // Adjust poll rate. |
903 poll_timer_.Stop(); | 903 poll_timer_.Stop(); |
904 poll_timer_.Start(FROM_HERE, poll, this, &SyncScheduler::PollTimerCallback); | 904 poll_timer_.Start(poll, this, &SyncScheduler::PollTimerCallback); |
905 } | 905 } |
906 | 906 |
907 void SyncScheduler::RestartWaiting() { | 907 void SyncScheduler::RestartWaiting() { |
908 CHECK(wait_interval_.get()); | 908 CHECK(wait_interval_.get()); |
909 wait_interval_->timer.Stop(); | 909 wait_interval_->timer.Stop(); |
910 wait_interval_->timer.Start(FROM_HERE, wait_interval_->length, | 910 wait_interval_->timer.Start(wait_interval_->length, |
911 this, &SyncScheduler::DoCanaryJob); | 911 this, &SyncScheduler::DoCanaryJob); |
912 } | 912 } |
913 | 913 |
914 void SyncScheduler::HandleConsecutiveContinuationError( | 914 void SyncScheduler::HandleConsecutiveContinuationError( |
915 const SyncSessionJob& old_job) { | 915 const SyncSessionJob& old_job) { |
916 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 916 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
917 if (DCHECK_IS_ON()) { | 917 if (DCHECK_IS_ON()) { |
918 if (IsBackingOff()) { | 918 if (IsBackingOff()) { |
919 DCHECK(wait_interval_->timer.IsRunning() || old_job.is_canary_job); | 919 DCHECK(wait_interval_->timer.IsRunning() || old_job.is_canary_job); |
920 } | 920 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 bool SyncScheduler::IsBackingOff() const { | 1070 bool SyncScheduler::IsBackingOff() const { |
1071 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1071 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
1072 return wait_interval_.get() && wait_interval_->mode == | 1072 return wait_interval_.get() && wait_interval_->mode == |
1073 WaitInterval::EXPONENTIAL_BACKOFF; | 1073 WaitInterval::EXPONENTIAL_BACKOFF; |
1074 } | 1074 } |
1075 | 1075 |
1076 void SyncScheduler::OnSilencedUntil(const base::TimeTicks& silenced_until) { | 1076 void SyncScheduler::OnSilencedUntil(const base::TimeTicks& silenced_until) { |
1077 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1077 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
1078 wait_interval_.reset(new WaitInterval(WaitInterval::THROTTLED, | 1078 wait_interval_.reset(new WaitInterval(WaitInterval::THROTTLED, |
1079 silenced_until - TimeTicks::Now())); | 1079 silenced_until - TimeTicks::Now())); |
1080 wait_interval_->timer.Start(FROM_HERE, wait_interval_->length, this, | 1080 wait_interval_->timer.Start(wait_interval_->length, this, |
1081 &SyncScheduler::Unthrottle); | 1081 &SyncScheduler::Unthrottle); |
1082 } | 1082 } |
1083 | 1083 |
1084 bool SyncScheduler::IsSyncingCurrentlySilenced() { | 1084 bool SyncScheduler::IsSyncingCurrentlySilenced() { |
1085 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1085 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
1086 return wait_interval_.get() && wait_interval_->mode == | 1086 return wait_interval_.get() && wait_interval_->mode == |
1087 WaitInterval::THROTTLED; | 1087 WaitInterval::THROTTLED; |
1088 } | 1088 } |
1089 | 1089 |
1090 void SyncScheduler::OnReceivedShortPollIntervalUpdate( | 1090 void SyncScheduler::OnReceivedShortPollIntervalUpdate( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 | 1155 |
1156 #undef SVLOG_LOC | 1156 #undef SVLOG_LOC |
1157 | 1157 |
1158 #undef SVLOG | 1158 #undef SVLOG |
1159 | 1159 |
1160 #undef SLOG | 1160 #undef SLOG |
1161 | 1161 |
1162 #undef ENUM_CASE | 1162 #undef ENUM_CASE |
1163 | 1163 |
1164 } // browser_sync | 1164 } // browser_sync |
OLD | NEW |