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

Side by Side Diff: sync/sessions/data_type_tracker.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 | « sync/sessions/data_type_tracker.h ('k') | sync/sessions/nudge_tracker.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sessions/data_type_tracker.h" 5 #include "sync/sessions/data_type_tracker.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "sync/sessions/nudge_tracker.h" 8 #include "sync/sessions/nudge_tracker.h"
9 9
10 namespace syncer { 10 namespace syncer {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 // This limit will take effect on all future invalidations received. 53 // This limit will take effect on all future invalidations received.
54 void DataTypeTracker::UpdatePayloadBufferSize(size_t new_size) { 54 void DataTypeTracker::UpdatePayloadBufferSize(size_t new_size) {
55 payload_buffer_size_ = new_size; 55 payload_buffer_size_ = new_size;
56 } 56 }
57 57
58 bool DataTypeTracker::IsSyncRequired() const { 58 bool DataTypeTracker::IsSyncRequired() const {
59 return !IsThrottled() && 59 return !IsThrottled() &&
60 (local_nudge_count_ > 0 || 60 (local_nudge_count_ > 0 ||
61 local_refresh_request_count_ > 0 || 61 local_refresh_request_count_ > 0 ||
62 !pending_payloads_.empty()); 62 HasPendingInvalidation() ||
63 local_payload_overflow_ ||
64 server_payload_overflow_);
65 }
66
67 bool DataTypeTracker::IsGetUpdatesRequired() const {
68 return !IsThrottled() &&
69 (local_refresh_request_count_ > 0 ||
70 HasPendingInvalidation() ||
71 local_payload_overflow_ ||
72 server_payload_overflow_);
63 } 73 }
64 74
65 bool DataTypeTracker::HasLocalChangePending() const { 75 bool DataTypeTracker::HasLocalChangePending() const {
66 return local_nudge_count_ > 0; 76 return local_nudge_count_ > 0;
67 } 77 }
68 78
69 bool DataTypeTracker::HasPendingInvalidation() const { 79 bool DataTypeTracker::HasPendingInvalidation() const {
70 return !pending_payloads_.empty(); 80 return !pending_payloads_.empty();
71 } 81 }
72 82
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 139 }
130 140
131 void DataTypeTracker::UpdateThrottleState(base::TimeTicks now) { 141 void DataTypeTracker::UpdateThrottleState(base::TimeTicks now) {
132 if (now >= unthrottle_time_) { 142 if (now >= unthrottle_time_) {
133 unthrottle_time_ = base::TimeTicks(); 143 unthrottle_time_ = base::TimeTicks();
134 } 144 }
135 } 145 }
136 146
137 } // namespace sessions 147 } // namespace sessions
138 } // namespace syncer 148 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/data_type_tracker.h ('k') | sync/sessions/nudge_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698