| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "components/sync/engine_impl/cycle/nudge_tracker.h" | 5 #include "components/sync/engine_impl/cycle/nudge_tracker.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "components/sync/engine/polling_constants.h" | 11 #include "components/sync/engine/polling_constants.h" |
| 12 | 12 |
| 13 namespace syncer { | 13 namespace syncer { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // Delays for syncer nudges. | 17 // Delays for syncer nudges. |
| 18 const int kDefaultNudgeDelayMilliseconds = 200; | 18 const int kDefaultNudgeDelayMilliseconds = 200; |
| 19 const int kSlowNudgeDelayMilliseconds = 2000; | 19 const int kSlowNudgeDelayMilliseconds = 2000; |
| 20 const int kSyncRefreshDelayMilliseconds = 500; | 20 const int kSyncRefreshDelayMilliseconds = 500; |
| 21 const int kSyncSchedulerDelayMilliseconds = 250; | 21 const int kSyncSchedulerDelayMilliseconds = 250; |
| 22 | 22 |
| 23 base::TimeDelta GetDefaultDelayForType(ModelType model_type, | 23 base::TimeDelta GetDefaultDelayForType(ModelType model_type, |
| 24 base::TimeDelta minimum_delay) { | 24 base::TimeDelta minimum_delay) { |
| 25 switch (model_type) { | 25 switch (model_type) { |
| 26 case AUTOFILL: | 26 case AUTOFILL: |
| 27 case USER_EVENTS: |
| 27 // Accompany types rely on nudges from other types, and hence have long | 28 // Accompany types rely on nudges from other types, and hence have long |
| 28 // nudge delays. | 29 // nudge delays. |
| 29 return base::TimeDelta::FromSeconds(kDefaultShortPollIntervalSeconds); | 30 return base::TimeDelta::FromSeconds(kDefaultShortPollIntervalSeconds); |
| 30 case BOOKMARKS: | 31 case BOOKMARKS: |
| 31 case PREFERENCES: | 32 case PREFERENCES: |
| 32 case SESSIONS: | 33 case SESSIONS: |
| 33 case FAVICON_IMAGES: | 34 case FAVICON_IMAGES: |
| 34 case FAVICON_TRACKING: | 35 case FAVICON_TRACKING: |
| 35 // Types with sometimes automatic changes get longer delays to allow more | 36 // Types with sometimes automatic changes get longer delays to allow more |
| 36 // coalescing. | 37 // coalescing. |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 GetDefaultDelayForType(type, minimum_local_nudge_delay_)); | 414 GetDefaultDelayForType(type, minimum_local_nudge_delay_)); |
| 414 } | 415 } |
| 415 } | 416 } |
| 416 } | 417 } |
| 417 | 418 |
| 418 void NudgeTracker::SetDefaultNudgeDelay(base::TimeDelta nudge_delay) { | 419 void NudgeTracker::SetDefaultNudgeDelay(base::TimeDelta nudge_delay) { |
| 419 minimum_local_nudge_delay_ = nudge_delay; | 420 minimum_local_nudge_delay_ = nudge_delay; |
| 420 } | 421 } |
| 421 | 422 |
| 422 } // namespace syncer | 423 } // namespace syncer |
| OLD | NEW |