| OLD | NEW | 
|---|
| 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  Loading... | 
| 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  Loading... | 
| 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 | 
| OLD | NEW | 
|---|