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 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/single_thread_task_runner.h" | |
maxbogue
2016/06/06 16:52:17
Has it been considered to just include this header
| |
18 #include "base/threading/thread_task_runner_handle.h" | |
17 #include "sync/engine/backoff_delay_provider.h" | 19 #include "sync/engine/backoff_delay_provider.h" |
18 #include "sync/engine/syncer.h" | 20 #include "sync/engine/syncer.h" |
19 #include "sync/protocol/proto_enum_conversions.h" | 21 #include "sync/protocol/proto_enum_conversions.h" |
20 #include "sync/protocol/sync.pb.h" | 22 #include "sync/protocol/sync.pb.h" |
21 #include "sync/util/data_type_histogram.h" | 23 #include "sync/util/data_type_histogram.h" |
22 #include "sync/util/logging.h" | 24 #include "sync/util/logging.h" |
23 | 25 |
24 using base::TimeDelta; | 26 using base::TimeDelta; |
25 using base::TimeTicks; | 27 using base::TimeTicks; |
26 | 28 |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 // privileges. Everyone else should use NORMAL_PRIORITY. | 741 // privileges. Everyone else should use NORMAL_PRIORITY. |
740 void SyncSchedulerImpl::TryCanaryJob() { | 742 void SyncSchedulerImpl::TryCanaryJob() { |
741 next_sync_session_job_priority_ = CANARY_PRIORITY; | 743 next_sync_session_job_priority_ = CANARY_PRIORITY; |
742 SDVLOG(2) << "Attempting canary job"; | 744 SDVLOG(2) << "Attempting canary job"; |
743 TrySyncSessionJob(); | 745 TrySyncSessionJob(); |
744 } | 746 } |
745 | 747 |
746 void SyncSchedulerImpl::TrySyncSessionJob() { | 748 void SyncSchedulerImpl::TrySyncSessionJob() { |
747 // Post call to TrySyncSessionJobImpl on current thread. Later request for | 749 // Post call to TrySyncSessionJobImpl on current thread. Later request for |
748 // access token will be here. | 750 // access token will be here. |
749 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 751 base::ThreadTaskRunnerHandle::Get()->PostTask( |
750 &SyncSchedulerImpl::TrySyncSessionJobImpl, | 752 FROM_HERE, base::Bind(&SyncSchedulerImpl::TrySyncSessionJobImpl, |
751 weak_ptr_factory_.GetWeakPtr())); | 753 weak_ptr_factory_.GetWeakPtr())); |
752 } | 754 } |
753 | 755 |
754 void SyncSchedulerImpl::TrySyncSessionJobImpl() { | 756 void SyncSchedulerImpl::TrySyncSessionJobImpl() { |
755 JobPriority priority = next_sync_session_job_priority_; | 757 JobPriority priority = next_sync_session_job_priority_; |
756 next_sync_session_job_priority_ = NORMAL_PRIORITY; | 758 next_sync_session_job_priority_ = NORMAL_PRIORITY; |
757 | 759 |
758 nudge_tracker_.SetSyncCycleStartTime(base::TimeTicks::Now()); | 760 nudge_tracker_.SetSyncCycleStartTime(base::TimeTicks::Now()); |
759 | 761 |
760 DCHECK(CalledOnValidThread()); | 762 DCHECK(CalledOnValidThread()); |
761 if (mode_ == CONFIGURATION_MODE) { | 763 if (mode_ == CONFIGURATION_MODE) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
988 | 990 |
989 #undef SDVLOG_LOC | 991 #undef SDVLOG_LOC |
990 | 992 |
991 #undef SDVLOG | 993 #undef SDVLOG |
992 | 994 |
993 #undef SLOG | 995 #undef SLOG |
994 | 996 |
995 #undef ENUM_CASE | 997 #undef ENUM_CASE |
996 | 998 |
997 } // namespace syncer | 999 } // namespace syncer |
OLD | NEW |