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

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: 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
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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 #define PER_DATA_TYPE_MACRO(type_str) \ 604 #define PER_DATA_TYPE_MACRO(type_str) \
605 SYNC_FREQ_HISTOGRAM("Sync.Freq" type_str, now - previous); 605 SYNC_FREQ_HISTOGRAM("Sync.Freq" type_str, now - previous);
606 SYNC_DATA_TYPE_HISTOGRAM(iter.Get()); 606 SYNC_DATA_TYPE_HISTOGRAM(iter.Get());
607 #undef PER_DATA_TYPE_MACRO 607 #undef PER_DATA_TYPE_MACRO
608 } 608 }
609 } 609 }
610 610
611 void SyncSchedulerImpl::AdjustPolling(PollAdjustType type) { 611 void SyncSchedulerImpl::AdjustPolling(PollAdjustType type) {
612 DCHECK(CalledOnValidThread()); 612 DCHECK(CalledOnValidThread());
613 613
614 TimeDelta poll = (!session_context_->notifications_enabled()) ? 614 TimeDelta poll = (!session_context_->notifications_enabled() ||
615 !sesion_context_->should_fetch_updates_before_commit()) ?
615 syncer_short_poll_interval_seconds_ : 616 syncer_short_poll_interval_seconds_ :
616 syncer_long_poll_interval_seconds_; 617 syncer_long_poll_interval_seconds_;
617 bool rate_changed = !poll_timer_.IsRunning() || 618 bool rate_changed = !poll_timer_.IsRunning() ||
618 poll != poll_timer_.GetCurrentDelay(); 619 poll != poll_timer_.GetCurrentDelay();
619 620
620 if (type == FORCE_RESET && !rate_changed) 621 if (type == FORCE_RESET && !rate_changed)
621 poll_timer_.Reset(); 622 poll_timer_.Reset();
622 623
623 if (!rate_changed) 624 if (!rate_changed)
624 return; 625 return;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 895
895 #undef SDVLOG_LOC 896 #undef SDVLOG_LOC
896 897
897 #undef SDVLOG 898 #undef SDVLOG
898 899
899 #undef SLOG 900 #undef SLOG
900 901
901 #undef ENUM_CASE 902 #undef ENUM_CASE
902 903
903 } // namespace syncer 904 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698