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