Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: sync/engine/sync_scheduler_impl.h

Issue 14963002: sync: Report GetUpdate triggers to the server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review response: lots of renames Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 sessions::SyncSessionContext* context, 49 sessions::SyncSessionContext* context,
50 Syncer* syncer); 50 Syncer* syncer);
51 51
52 // Calls Stop(). 52 // Calls Stop().
53 virtual ~SyncSchedulerImpl(); 53 virtual ~SyncSchedulerImpl();
54 54
55 virtual void Start(Mode mode) OVERRIDE; 55 virtual void Start(Mode mode) OVERRIDE;
56 virtual bool ScheduleConfiguration( 56 virtual bool ScheduleConfiguration(
57 const ConfigurationParams& params) OVERRIDE; 57 const ConfigurationParams& params) OVERRIDE;
58 virtual void RequestStop(const base::Closure& callback) OVERRIDE; 58 virtual void RequestStop(const base::Closure& callback) OVERRIDE;
59 virtual void ScheduleNudgeAsync( 59 virtual void ScheduleLocalNudge(
60 const base::TimeDelta& desired_delay, 60 const base::TimeDelta& desired_delay,
61 NudgeSource source,
62 ModelTypeSet types, 61 ModelTypeSet types,
63 const tracked_objects::Location& nudge_location) OVERRIDE; 62 const tracked_objects::Location& nudge_location) OVERRIDE;
64 virtual void ScheduleNudgeWithStatesAsync( 63 virtual void ScheduleLocalRefreshRequest(
65 const base::TimeDelta& desired_delay, NudgeSource source, 64 const base::TimeDelta& desired_delay,
65 ModelTypeSet types,
66 const tracked_objects::Location& nudge_location) OVERRIDE;
67 virtual void ScheduleInvalidationNudge(
68 const base::TimeDelta& desired_delay,
66 const ModelTypeInvalidationMap& invalidation_map, 69 const ModelTypeInvalidationMap& invalidation_map,
67 const tracked_objects::Location& nudge_location) OVERRIDE; 70 const tracked_objects::Location& nudge_location) OVERRIDE;
68 virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE; 71 virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE;
69 72
70 virtual base::TimeDelta GetSessionsCommitDelay() const OVERRIDE; 73 virtual base::TimeDelta GetSessionsCommitDelay() const OVERRIDE;
71 74
72 virtual void OnCredentialsUpdated() OVERRIDE; 75 virtual void OnCredentialsUpdated() OVERRIDE;
73 virtual void OnConnectionStatusChange() OVERRIDE; 76 virtual void OnConnectionStatusChange() OVERRIDE;
74 77
75 // SyncSession::Delegate implementation. 78 // SyncSession::Delegate implementation.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 183
181 // 'Impl' here refers to real implementation of public functions. 184 // 'Impl' here refers to real implementation of public functions.
182 void StopImpl(const base::Closure& callback); 185 void StopImpl(const base::Closure& callback);
183 186
184 // If the scheduler's current state supports it, this will create a job based 187 // If the scheduler's current state supports it, this will create a job based
185 // on the passed in parameters and coalesce it with any other pending jobs, 188 // on the passed in parameters and coalesce it with any other pending jobs,
186 // then post a delayed task to run it. It may also choose to drop the job or 189 // then post a delayed task to run it. It may also choose to drop the job or
187 // save it for later, depending on the scheduler's current state. 190 // save it for later, depending on the scheduler's current state.
188 void ScheduleNudgeImpl( 191 void ScheduleNudgeImpl(
189 const base::TimeDelta& delay, 192 const base::TimeDelta& delay,
190 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
191 const ModelTypeInvalidationMap& invalidation_map,
192 const tracked_objects::Location& nudge_location); 193 const tracked_objects::Location& nudge_location);
193 194
194 // Returns true if the client is currently in exponential backoff. 195 // Returns true if the client is currently in exponential backoff.
195 bool IsBackingOff() const; 196 bool IsBackingOff() const;
196 197
197 // Helper to signal all listeners registered with |session_context_|. 198 // Helper to signal all listeners registered with |session_context_|.
198 void Notify(SyncEngineEvent::EventCause cause); 199 void Notify(SyncEngineEvent::EventCause cause);
199 200
200 // Helper to signal listeners about changed retry time 201 // Helper to signal listeners about changed retry time
201 void NotifyRetryTime(base::Time retry_time); 202 void NotifyRetryTime(base::Time retry_time);
(...skipping 13 matching lines...) Expand all
215 216
216 // Called as we are started to broadcast an initial session snapshot 217 // Called as we are started to broadcast an initial session snapshot
217 // containing data like initial_sync_ended. Important when the client starts 218 // containing data like initial_sync_ended. Important when the client starts
218 // up and does not need to perform an initial sync. 219 // up and does not need to perform an initial sync.
219 void SendInitialSnapshot(); 220 void SendInitialSnapshot();
220 221
221 // This is used for histogramming and analysis of ScheduleNudge* APIs. 222 // This is used for histogramming and analysis of ScheduleNudge* APIs.
222 // SyncScheduler is the ultimate choke-point for all such invocations (with 223 // SyncScheduler is the ultimate choke-point for all such invocations (with
223 // and without InvalidationState variants, all NudgeSources, etc) and as such 224 // and without InvalidationState variants, all NudgeSources, etc) and as such
224 // is the most flexible place to do this bookkeeping. 225 // is the most flexible place to do this bookkeeping.
225 void UpdateNudgeTimeRecords(const sessions::SyncSourceInfo& info); 226 void UpdateNudgeTimeRecords(ModelTypeSet types);
226 227
227 virtual void OnActionableError(const sessions::SyncSessionSnapshot& snapshot); 228 virtual void OnActionableError(const sessions::SyncSessionSnapshot& snapshot);
228 229
229 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_; 230 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_;
230 231
231 // A second factory specially for weak_handle_this_, to allow the handle 232 // A second factory specially for weak_handle_this_, to allow the handle
232 // to be const and alleviate threading concerns. 233 // to be const and alleviate threading concerns.
233 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_; 234 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_for_weak_handle_;
234 235
235 // For certain methods that need to worry about X-thread posting. 236 // For certain methods that need to worry about X-thread posting.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // take place during a sync cycle. We call this out because such violations 291 // take place during a sync cycle. We call this out because such violations
291 // could result in tight sync loops hitting sync servers. 292 // could result in tight sync loops hitting sync servers.
292 bool no_scheduling_allowed_; 293 bool no_scheduling_allowed_;
293 294
294 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); 295 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl);
295 }; 296 };
296 297
297 } // namespace syncer 298 } // namespace syncer
298 299
299 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_ 300 #endif // SYNC_ENGINE_SYNC_SCHEDULER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698