| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sync/engine/sync_scheduler_impl.h" | 5 #include "sync/engine/sync_scheduler_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 #define PER_DATA_TYPE_MACRO(type_str) \ | 609 #define PER_DATA_TYPE_MACRO(type_str) \ |
| 610 SYNC_FREQ_HISTOGRAM("Sync.Freq" type_str, now - previous); | 610 SYNC_FREQ_HISTOGRAM("Sync.Freq" type_str, now - previous); |
| 611 SYNC_DATA_TYPE_HISTOGRAM(iter.Get()); | 611 SYNC_DATA_TYPE_HISTOGRAM(iter.Get()); |
| 612 #undef PER_DATA_TYPE_MACRO | 612 #undef PER_DATA_TYPE_MACRO |
| 613 } | 613 } |
| 614 } | 614 } |
| 615 | 615 |
| 616 void SyncSchedulerImpl::AdjustPolling(PollAdjustType type) { | 616 void SyncSchedulerImpl::AdjustPolling(PollAdjustType type) { |
| 617 DCHECK(CalledOnValidThread()); | 617 DCHECK(CalledOnValidThread()); |
| 618 | 618 |
| 619 TimeDelta poll = (!session_context_->notifications_enabled()) ? | 619 TimeDelta poll = (!session_context_->notifications_enabled() || |
| 620 !session_context_->ShouldFetchUpdatesBeforeCommit()) ? |
| 620 syncer_short_poll_interval_seconds_ : | 621 syncer_short_poll_interval_seconds_ : |
| 621 syncer_long_poll_interval_seconds_; | 622 syncer_long_poll_interval_seconds_; |
| 622 bool rate_changed = !poll_timer_.IsRunning() || | 623 bool rate_changed = !poll_timer_.IsRunning() || |
| 623 poll != poll_timer_.GetCurrentDelay(); | 624 poll != poll_timer_.GetCurrentDelay(); |
| 624 | 625 |
| 625 if (type == FORCE_RESET && !rate_changed) | 626 if (type == FORCE_RESET && !rate_changed) |
| 626 poll_timer_.Reset(); | 627 poll_timer_.Reset(); |
| 627 | 628 |
| 628 if (!rate_changed) | 629 if (!rate_changed) |
| 629 return; | 630 return; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 | 918 |
| 918 #undef SDVLOG_LOC | 919 #undef SDVLOG_LOC |
| 919 | 920 |
| 920 #undef SDVLOG | 921 #undef SDVLOG |
| 921 | 922 |
| 922 #undef SLOG | 923 #undef SLOG |
| 923 | 924 |
| 924 #undef ENUM_CASE | 925 #undef ENUM_CASE |
| 925 | 926 |
| 926 } // namespace syncer | 927 } // namespace syncer |
| OLD | NEW |