Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: sync/engine/sync_scheduler_impl.cc

Issue 19309002: sync: Add pre-commit update avoidance mode + flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | sync/engine/sync_scheduler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | sync/engine/sync_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698