| 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/internal_api/public/base/invalidation_interface.h" | 8 #include "sync/internal_api/public/base/invalidation_interface.h" |
| 9 #include "sync/sessions/nudge_tracker.h" | 9 #include "sync/sessions/nudge_tracker.h" |
| 10 | 10 |
| 11 namespace syncer { | 11 namespace syncer { |
| 12 namespace sessions { | 12 namespace sessions { |
| 13 | 13 |
| 14 DataTypeTracker::DataTypeTracker() | 14 DataTypeTracker::DataTypeTracker() |
| 15 : local_nudge_count_(0), | 15 : local_nudge_count_(0), |
| 16 local_refresh_request_count_(0), | 16 local_refresh_request_count_(0), |
| 17 payload_buffer_size_(NudgeTracker::kDefaultMaxPayloadsPerType), | 17 payload_buffer_size_(NudgeTracker::kDefaultMaxPayloadsPerType), |
| 18 initial_sync_required_(false) { | 18 initial_sync_required_(false) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 DataTypeTracker::~DataTypeTracker() { } | 21 DataTypeTracker::~DataTypeTracker() { } |
| 22 | 22 |
| 23 void DataTypeTracker::RecordLocalChange() { | 23 base::TimeDelta DataTypeTracker::RecordLocalChange() { |
| 24 local_nudge_count_++; | 24 local_nudge_count_++; |
| 25 return nudge_delay_; |
| 25 } | 26 } |
| 26 | 27 |
| 27 void DataTypeTracker::RecordLocalRefreshRequest() { | 28 void DataTypeTracker::RecordLocalRefreshRequest() { |
| 28 local_refresh_request_count_++; | 29 local_refresh_request_count_++; |
| 29 } | 30 } |
| 30 | 31 |
| 31 void DataTypeTracker::RecordRemoteInvalidation( | 32 void DataTypeTracker::RecordRemoteInvalidation( |
| 32 scoped_ptr<InvalidationInterface> incoming) { | 33 scoped_ptr<InvalidationInterface> incoming) { |
| 33 DCHECK(incoming); | 34 DCHECK(incoming); |
| 34 | 35 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 base::TimeTicks now) { | 212 base::TimeTicks now) { |
| 212 unthrottle_time_ = std::max(unthrottle_time_, now + duration); | 213 unthrottle_time_ = std::max(unthrottle_time_, now + duration); |
| 213 } | 214 } |
| 214 | 215 |
| 215 void DataTypeTracker::UpdateThrottleState(base::TimeTicks now) { | 216 void DataTypeTracker::UpdateThrottleState(base::TimeTicks now) { |
| 216 if (now >= unthrottle_time_) { | 217 if (now >= unthrottle_time_) { |
| 217 unthrottle_time_ = base::TimeTicks(); | 218 unthrottle_time_ = base::TimeTicks(); |
| 218 } | 219 } |
| 219 } | 220 } |
| 220 | 221 |
| 222 void DataTypeTracker::UpdateLocalNudgeDelay(base::TimeDelta delay) { |
| 223 nudge_delay_ = delay; |
| 224 } |
| 225 |
| 221 } // namespace sessions | 226 } // namespace sessions |
| 222 } // namespace syncer | 227 } // namespace syncer |
| OLD | NEW |