| 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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 poll != poll_timer_.GetCurrentDelay(); | 868 poll != poll_timer_.GetCurrentDelay(); |
| 869 | 869 |
| 870 if (old_job && old_job->purpose != SyncSessionJob::POLL && !rate_changed) | 870 if (old_job && old_job->purpose != SyncSessionJob::POLL && !rate_changed) |
| 871 poll_timer_.Reset(); | 871 poll_timer_.Reset(); |
| 872 | 872 |
| 873 if (!rate_changed) | 873 if (!rate_changed) |
| 874 return; | 874 return; |
| 875 | 875 |
| 876 // Adjust poll rate. | 876 // Adjust poll rate. |
| 877 poll_timer_.Stop(); | 877 poll_timer_.Stop(); |
| 878 poll_timer_.Start(poll, this, &SyncScheduler::PollTimerCallback); | 878 poll_timer_.Start(FROM_HERE, poll, this, &SyncScheduler::PollTimerCallback); |
| 879 } | 879 } |
| 880 | 880 |
| 881 void SyncScheduler::RestartWaiting() { | 881 void SyncScheduler::RestartWaiting() { |
| 882 CHECK(wait_interval_.get()); | 882 CHECK(wait_interval_.get()); |
| 883 wait_interval_->timer.Stop(); | 883 wait_interval_->timer.Stop(); |
| 884 wait_interval_->timer.Start(wait_interval_->length, | 884 wait_interval_->timer.Start(FROM_HERE, wait_interval_->length, |
| 885 this, &SyncScheduler::DoCanaryJob); | 885 this, &SyncScheduler::DoCanaryJob); |
| 886 } | 886 } |
| 887 | 887 |
| 888 void SyncScheduler::HandleConsecutiveContinuationError( | 888 void SyncScheduler::HandleConsecutiveContinuationError( |
| 889 const SyncSessionJob& old_job) { | 889 const SyncSessionJob& old_job) { |
| 890 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 890 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 891 if (DCHECK_IS_ON()) { | 891 if (DCHECK_IS_ON()) { |
| 892 if (IsBackingOff()) { | 892 if (IsBackingOff()) { |
| 893 DCHECK(wait_interval_->timer.IsRunning() || old_job.is_canary_job); | 893 DCHECK(wait_interval_->timer.IsRunning() || old_job.is_canary_job); |
| 894 } | 894 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 bool SyncScheduler::IsBackingOff() const { | 1042 bool SyncScheduler::IsBackingOff() const { |
| 1043 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1043 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 1044 return wait_interval_.get() && wait_interval_->mode == | 1044 return wait_interval_.get() && wait_interval_->mode == |
| 1045 WaitInterval::EXPONENTIAL_BACKOFF; | 1045 WaitInterval::EXPONENTIAL_BACKOFF; |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 void SyncScheduler::OnSilencedUntil(const base::TimeTicks& silenced_until) { | 1048 void SyncScheduler::OnSilencedUntil(const base::TimeTicks& silenced_until) { |
| 1049 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1049 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 1050 wait_interval_.reset(new WaitInterval(WaitInterval::THROTTLED, | 1050 wait_interval_.reset(new WaitInterval(WaitInterval::THROTTLED, |
| 1051 silenced_until - TimeTicks::Now())); | 1051 silenced_until - TimeTicks::Now())); |
| 1052 wait_interval_->timer.Start(wait_interval_->length, this, | 1052 wait_interval_->timer.Start(FROM_HERE, wait_interval_->length, this, |
| 1053 &SyncScheduler::Unthrottle); | 1053 &SyncScheduler::Unthrottle); |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 bool SyncScheduler::IsSyncingCurrentlySilenced() { | 1056 bool SyncScheduler::IsSyncingCurrentlySilenced() { |
| 1057 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1057 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 1058 return wait_interval_.get() && wait_interval_->mode == | 1058 return wait_interval_.get() && wait_interval_->mode == |
| 1059 WaitInterval::THROTTLED; | 1059 WaitInterval::THROTTLED; |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 void SyncScheduler::OnReceivedShortPollIntervalUpdate( | 1062 void SyncScheduler::OnReceivedShortPollIntervalUpdate( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 | 1105 |
| 1106 #undef SVLOG_LOC | 1106 #undef SVLOG_LOC |
| 1107 | 1107 |
| 1108 #undef SVLOG | 1108 #undef SVLOG |
| 1109 | 1109 |
| 1110 #undef SLOG | 1110 #undef SLOG |
| 1111 | 1111 |
| 1112 #undef ENUM_CASE | 1112 #undef ENUM_CASE |
| 1113 | 1113 |
| 1114 } // browser_sync | 1114 } // browser_sync |
| OLD | NEW |