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 "sync/engine/sync_scheduler_impl.h" | 5 #include "sync/engine/sync_scheduler_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/location.h" | 14 #include "base/location.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
16 #include "sync/engine/backoff_delay_provider.h" | 17 #include "sync/engine/backoff_delay_provider.h" |
17 #include "sync/engine/syncer.h" | 18 #include "sync/engine/syncer.h" |
18 #include "sync/protocol/proto_enum_conversions.h" | 19 #include "sync/protocol/proto_enum_conversions.h" |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 415 |
415 void SyncSchedulerImpl::ScheduleInvalidationNudge( | 416 void SyncSchedulerImpl::ScheduleInvalidationNudge( |
416 syncer::ModelType model_type, | 417 syncer::ModelType model_type, |
417 scoped_ptr<InvalidationInterface> invalidation, | 418 scoped_ptr<InvalidationInterface> invalidation, |
418 const tracked_objects::Location& nudge_location) { | 419 const tracked_objects::Location& nudge_location) { |
419 DCHECK(CalledOnValidThread()); | 420 DCHECK(CalledOnValidThread()); |
420 | 421 |
421 SDVLOG_LOC(nudge_location, 2) | 422 SDVLOG_LOC(nudge_location, 2) |
422 << "Scheduling sync because we received invalidation for " | 423 << "Scheduling sync because we received invalidation for " |
423 << ModelTypeToString(model_type); | 424 << ModelTypeToString(model_type); |
424 base::TimeDelta nudge_delay = | 425 base::TimeDelta nudge_delay = nudge_tracker_.RecordRemoteInvalidation( |
425 nudge_tracker_.RecordRemoteInvalidation(model_type, invalidation.Pass()); | 426 model_type, std::move(invalidation)); |
426 ScheduleNudgeImpl(nudge_delay, nudge_location); | 427 ScheduleNudgeImpl(nudge_delay, nudge_location); |
427 } | 428 } |
428 | 429 |
429 void SyncSchedulerImpl::ScheduleInitialSyncNudge(syncer::ModelType model_type) { | 430 void SyncSchedulerImpl::ScheduleInitialSyncNudge(syncer::ModelType model_type) { |
430 DCHECK(CalledOnValidThread()); | 431 DCHECK(CalledOnValidThread()); |
431 | 432 |
432 SDVLOG(2) << "Scheduling non-blocking initial sync for " | 433 SDVLOG(2) << "Scheduling non-blocking initial sync for " |
433 << ModelTypeToString(model_type); | 434 << ModelTypeToString(model_type); |
434 nudge_tracker_.RecordInitialSyncRequired(model_type); | 435 nudge_tracker_.RecordInitialSyncRequired(model_type); |
435 ScheduleNudgeImpl(TimeDelta::FromSeconds(0), FROM_HERE); | 436 ScheduleNudgeImpl(TimeDelta::FromSeconds(0), FROM_HERE); |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 | 981 |
981 #undef SDVLOG_LOC | 982 #undef SDVLOG_LOC |
982 | 983 |
983 #undef SDVLOG | 984 #undef SDVLOG |
984 | 985 |
985 #undef SLOG | 986 #undef SLOG |
986 | 987 |
987 #undef ENUM_CASE | 988 #undef ENUM_CASE |
988 | 989 |
989 } // namespace syncer | 990 } // namespace syncer |
OLD | NEW |