| OLD | NEW |
| 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 "components/sync/engine_impl/sync_scheduler_impl.h" | 5 #include "components/sync/engine_impl/sync_scheduler_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 DCHECK(!types.Empty()); | 404 DCHECK(!types.Empty()); |
| 405 | 405 |
| 406 SDVLOG_LOC(nudge_location, 2) | 406 SDVLOG_LOC(nudge_location, 2) |
| 407 << "Scheduling sync because of local refresh request for " | 407 << "Scheduling sync because of local refresh request for " |
| 408 << ModelTypeSetToString(types); | 408 << ModelTypeSetToString(types); |
| 409 base::TimeDelta nudge_delay = nudge_tracker_.RecordLocalRefreshRequest(types); | 409 base::TimeDelta nudge_delay = nudge_tracker_.RecordLocalRefreshRequest(types); |
| 410 ScheduleNudgeImpl(nudge_delay, nudge_location); | 410 ScheduleNudgeImpl(nudge_delay, nudge_location); |
| 411 } | 411 } |
| 412 | 412 |
| 413 void SyncSchedulerImpl::ScheduleInvalidationNudge( | 413 void SyncSchedulerImpl::ScheduleInvalidationNudge( |
| 414 syncer::ModelType model_type, | 414 ModelType model_type, |
| 415 std::unique_ptr<InvalidationInterface> invalidation, | 415 std::unique_ptr<InvalidationInterface> invalidation, |
| 416 const tracked_objects::Location& nudge_location) { | 416 const tracked_objects::Location& nudge_location) { |
| 417 DCHECK(CalledOnValidThread()); | 417 DCHECK(CalledOnValidThread()); |
| 418 | 418 |
| 419 SDVLOG_LOC(nudge_location, 2) | 419 SDVLOG_LOC(nudge_location, 2) |
| 420 << "Scheduling sync because we received invalidation for " | 420 << "Scheduling sync because we received invalidation for " |
| 421 << ModelTypeToString(model_type); | 421 << ModelTypeToString(model_type); |
| 422 base::TimeDelta nudge_delay = nudge_tracker_.RecordRemoteInvalidation( | 422 base::TimeDelta nudge_delay = nudge_tracker_.RecordRemoteInvalidation( |
| 423 model_type, std::move(invalidation)); | 423 model_type, std::move(invalidation)); |
| 424 ScheduleNudgeImpl(nudge_delay, nudge_location); | 424 ScheduleNudgeImpl(nudge_delay, nudge_location); |
| 425 } | 425 } |
| 426 | 426 |
| 427 void SyncSchedulerImpl::ScheduleInitialSyncNudge(syncer::ModelType model_type) { | 427 void SyncSchedulerImpl::ScheduleInitialSyncNudge(ModelType model_type) { |
| 428 DCHECK(CalledOnValidThread()); | 428 DCHECK(CalledOnValidThread()); |
| 429 | 429 |
| 430 SDVLOG(2) << "Scheduling non-blocking initial sync for " | 430 SDVLOG(2) << "Scheduling non-blocking initial sync for " |
| 431 << ModelTypeToString(model_type); | 431 << ModelTypeToString(model_type); |
| 432 nudge_tracker_.RecordInitialSyncRequired(model_type); | 432 nudge_tracker_.RecordInitialSyncRequired(model_type); |
| 433 ScheduleNudgeImpl(TimeDelta::FromSeconds(0), FROM_HERE); | 433 ScheduleNudgeImpl(TimeDelta::FromSeconds(0), FROM_HERE); |
| 434 } | 434 } |
| 435 | 435 |
| 436 // TODO(zea): Consider adding separate throttling/backoff for datatype | 436 // TODO(zea): Consider adding separate throttling/backoff for datatype |
| 437 // refresh requests. | 437 // refresh requests. |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 | 961 |
| 962 #undef SDVLOG_LOC | 962 #undef SDVLOG_LOC |
| 963 | 963 |
| 964 #undef SDVLOG | 964 #undef SDVLOG |
| 965 | 965 |
| 966 #undef SLOG | 966 #undef SLOG |
| 967 | 967 |
| 968 #undef ENUM_CASE | 968 #undef ENUM_CASE |
| 969 | 969 |
| 970 } // namespace syncer | 970 } // namespace syncer |
| OLD | NEW |