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 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 5 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
6 #define SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 6 #define SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/time.h" | 18 #include "base/time.h" |
19 #include "base/timer.h" | 19 #include "base/timer.h" |
20 #include "sync/engine/net/server_connection_manager.h" | 20 #include "sync/engine/net/server_connection_manager.h" |
21 #include "sync/engine/nudge_source.h" | 21 #include "sync/engine/nudge_source.h" |
22 #include "sync/engine/sync_scheduler.h" | 22 #include "sync/engine/sync_scheduler.h" |
23 #include "sync/engine/syncer.h" | 23 #include "sync/engine/syncer.h" |
24 #include "sync/internal_api/public/base/model_type_state_map.h" | 24 #include "sync/internal_api/public/base/model_type_invalidation_map.h" |
25 #include "sync/internal_api/public/engine/polling_constants.h" | 25 #include "sync/internal_api/public/engine/polling_constants.h" |
26 #include "sync/internal_api/public/util/weak_handle.h" | 26 #include "sync/internal_api/public/util/weak_handle.h" |
27 #include "sync/sessions/sync_session.h" | 27 #include "sync/sessions/sync_session.h" |
28 #include "sync/sessions/sync_session_context.h" | 28 #include "sync/sessions/sync_session_context.h" |
29 | 29 |
30 namespace syncer { | 30 namespace syncer { |
31 | 31 |
32 class BackoffDelayProvider; | 32 class BackoffDelayProvider; |
33 | 33 |
34 class SyncSchedulerImpl : public SyncScheduler { | 34 class SyncSchedulerImpl : public SyncScheduler { |
(...skipping 12 matching lines...) Expand all Loading... |
47 virtual bool ScheduleConfiguration( | 47 virtual bool ScheduleConfiguration( |
48 const ConfigurationParams& params) OVERRIDE; | 48 const ConfigurationParams& params) OVERRIDE; |
49 virtual void RequestStop(const base::Closure& callback) OVERRIDE; | 49 virtual void RequestStop(const base::Closure& callback) OVERRIDE; |
50 virtual void ScheduleNudgeAsync( | 50 virtual void ScheduleNudgeAsync( |
51 const base::TimeDelta& delay, | 51 const base::TimeDelta& delay, |
52 NudgeSource source, | 52 NudgeSource source, |
53 ModelTypeSet types, | 53 ModelTypeSet types, |
54 const tracked_objects::Location& nudge_location) OVERRIDE; | 54 const tracked_objects::Location& nudge_location) OVERRIDE; |
55 virtual void ScheduleNudgeWithStatesAsync( | 55 virtual void ScheduleNudgeWithStatesAsync( |
56 const base::TimeDelta& delay, NudgeSource source, | 56 const base::TimeDelta& delay, NudgeSource source, |
57 const ModelTypeStateMap& type_state_map, | 57 const ModelTypeInvalidationMap& invalidation_map, |
58 const tracked_objects::Location& nudge_location) OVERRIDE; | 58 const tracked_objects::Location& nudge_location) OVERRIDE; |
59 virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE; | 59 virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE; |
60 | 60 |
61 virtual base::TimeDelta GetSessionsCommitDelay() const OVERRIDE; | 61 virtual base::TimeDelta GetSessionsCommitDelay() const OVERRIDE; |
62 | 62 |
63 virtual void OnCredentialsUpdated() OVERRIDE; | 63 virtual void OnCredentialsUpdated() OVERRIDE; |
64 virtual void OnConnectionStatusChange() OVERRIDE; | 64 virtual void OnConnectionStatusChange() OVERRIDE; |
65 | 65 |
66 // SyncSession::Delegate implementation. | 66 // SyncSession::Delegate implementation. |
67 virtual void OnSilencedUntil( | 67 virtual void OnSilencedUntil( |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 // Coalesces the current job with the pending nudge. | 236 // Coalesces the current job with the pending nudge. |
237 void InitOrCoalescePendingJob(const SyncSessionJob& job); | 237 void InitOrCoalescePendingJob(const SyncSessionJob& job); |
238 | 238 |
239 // 'Impl' here refers to real implementation of public functions, running on | 239 // 'Impl' here refers to real implementation of public functions, running on |
240 // |thread_|. | 240 // |thread_|. |
241 void StopImpl(const base::Closure& callback); | 241 void StopImpl(const base::Closure& callback); |
242 void ScheduleNudgeImpl( | 242 void ScheduleNudgeImpl( |
243 const base::TimeDelta& delay, | 243 const base::TimeDelta& delay, |
244 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, | 244 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
245 const ModelTypeStateMap& type_state_map, | 245 const ModelTypeInvalidationMap& invalidation_map, |
246 bool is_canary_job, const tracked_objects::Location& nudge_location); | 246 bool is_canary_job, const tracked_objects::Location& nudge_location); |
247 | 247 |
248 // Returns true if the client is currently in exponential backoff. | 248 // Returns true if the client is currently in exponential backoff. |
249 bool IsBackingOff() const; | 249 bool IsBackingOff() const; |
250 | 250 |
251 // Helper to signal all listeners registered with |session_context_|. | 251 // Helper to signal all listeners registered with |session_context_|. |
252 void Notify(SyncEngineEvent::EventCause cause); | 252 void Notify(SyncEngineEvent::EventCause cause); |
253 | 253 |
254 // Callback to change backoff state. | 254 // Callback to change backoff state. |
255 void DoCanaryJob(); | 255 void DoCanaryJob(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // take place during a sync cycle. We call this out because such violations | 348 // take place during a sync cycle. We call this out because such violations |
349 // could result in tight sync loops hitting sync servers. | 349 // could result in tight sync loops hitting sync servers. |
350 bool no_scheduling_allowed_; | 350 bool no_scheduling_allowed_; |
351 | 351 |
352 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 352 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
353 }; | 353 }; |
354 | 354 |
355 } // namespace syncer | 355 } // namespace syncer |
356 | 356 |
357 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ | 357 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ |
OLD | NEW |