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

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

Issue 10542044: [Sync] Remove unnecessary posting of methods in sync scheduler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sync/engine/sync_scheduler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // A class to schedule syncer tasks intelligently. 5 // A class to schedule syncer tasks intelligently.
6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_ 6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_
7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_ 7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_
8 #pragma once 8 #pragma once
9 9
10 #include <string> 10 #include <string>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void Start(Mode mode, const base::Closure& callback); 69 void Start(Mode mode, const base::Closure& callback);
70 70
71 // Request that any running syncer task stop as soon as possible and 71 // Request that any running syncer task stop as soon as possible and
72 // cancel all scheduled tasks. This function can be called from any thread, 72 // cancel all scheduled tasks. This function can be called from any thread,
73 // and should in fact be called from a thread that isn't the sync loop to 73 // and should in fact be called from a thread that isn't the sync loop to
74 // allow preempting ongoing sync cycles. 74 // allow preempting ongoing sync cycles.
75 // Invokes |callback| from the sync loop once syncer is idle and all tasks 75 // Invokes |callback| from the sync loop once syncer is idle and all tasks
76 // are cancelled. 76 // are cancelled.
77 void RequestStop(const base::Closure& callback); 77 void RequestStop(const base::Closure& callback);
78 78
79 // The meat and potatoes. 79 // The meat and potatoes. Both of these methods will post a delayed task
80 void ScheduleNudge(const base::TimeDelta& delay, NudgeSource source, 80 // to attempt the actual nudge (see ScheduleNudgeImpl).
81 void ScheduleNudgeAsync(const base::TimeDelta& delay, NudgeSource source,
81 syncable::ModelTypeSet types, 82 syncable::ModelTypeSet types,
82 const tracked_objects::Location& nudge_location); 83 const tracked_objects::Location& nudge_location);
83 void ScheduleNudgeWithPayloads( 84 void ScheduleNudgeWithPayloadsAsync(
84 const base::TimeDelta& delay, NudgeSource source, 85 const base::TimeDelta& delay, NudgeSource source,
85 const syncable::ModelTypePayloadMap& types_with_payloads, 86 const syncable::ModelTypePayloadMap& types_with_payloads,
86 const tracked_objects::Location& nudge_location); 87 const tracked_objects::Location& nudge_location);
87 88
89 // Schedule a configuration cycle. May execute immediately or at a later time
90 // (depending on backoff/throttle state).
88 // Note: The source argument of this function must come from the subset of 91 // Note: The source argument of this function must come from the subset of
89 // GetUpdatesCallerInfo values related to configurations. 92 // GetUpdatesCallerInfo values related to configurations.
90 void ScheduleConfig( 93 void ScheduleConfigure(
tim (not reviewing) 2012/06/11 21:20:37 uber nit - Lets call this 'ScheduleConfiguration'
91 syncable::ModelTypeSet types, 94 syncable::ModelTypeSet types,
92 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); 95 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source);
93 96
94 void ScheduleClearUserData(); 97 // TODO(tim): remove this. crbug.com/131336
95 // If this is called before Start(), the cleanup is guaranteed to 98 void ClearUserData();
96 // happen before the Start finishes. 99
97 // 100 void CleanupDisabledTypes();
98 // TODO(akalin): Figure out how to test this.
99 void ScheduleCleanupDisabledTypes();
100 101
101 // Change status of notifications in the SyncSessionContext. 102 // Change status of notifications in the SyncSessionContext.
102 void set_notifications_enabled(bool notifications_enabled); 103 void set_notifications_enabled(bool notifications_enabled);
103 104
104 base::TimeDelta sessions_commit_delay() const; 105 base::TimeDelta sessions_commit_delay() const;
105 106
106 // DDOS avoidance function. Calculates how long we should wait before trying 107 // DDOS avoidance function. Calculates how long we should wait before trying
107 // again after a failed sync attempt, where the last delay was |base_delay|. 108 // again after a failed sync attempt, where the last delay was |base_delay|.
108 // TODO(tim): Look at URLRequestThrottlerEntryInterface. 109 // TODO(tim): Look at URLRequestThrottlerEntryInterface.
109 static base::TimeDelta GetRecommendedDelay(const base::TimeDelta& base_delay); 110 static base::TimeDelta GetRecommendedDelay(const base::TimeDelta& base_delay);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 JobProcessDecision DecideWhileInWaitInterval(const SyncSessionJob& job); 304 JobProcessDecision DecideWhileInWaitInterval(const SyncSessionJob& job);
304 305
305 // Saves the job for future execution. Note: It drops all the poll jobs. 306 // Saves the job for future execution. Note: It drops all the poll jobs.
306 void SaveJob(const SyncSessionJob& job); 307 void SaveJob(const SyncSessionJob& job);
307 308
308 // Coalesces the current job with the pending nudge. 309 // Coalesces the current job with the pending nudge.
309 void InitOrCoalescePendingJob(const SyncSessionJob& job); 310 void InitOrCoalescePendingJob(const SyncSessionJob& job);
310 311
311 // 'Impl' here refers to real implementation of public functions, running on 312 // 'Impl' here refers to real implementation of public functions, running on
312 // |thread_|. 313 // |thread_|.
313 void StartImpl(Mode mode, const base::Closure& callback);
314 void StopImpl(const base::Closure& callback); 314 void StopImpl(const base::Closure& callback);
315 void ScheduleNudgeImpl( 315 void ScheduleNudgeImpl(
316 const base::TimeDelta& delay, 316 const base::TimeDelta& delay,
317 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, 317 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
318 const syncable::ModelTypePayloadMap& types_with_payloads, 318 const syncable::ModelTypePayloadMap& types_with_payloads,
319 bool is_canary_job, const tracked_objects::Location& nudge_location); 319 bool is_canary_job, const tracked_objects::Location& nudge_location);
320 void ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info,
321 const std::vector<ModelSafeWorker*>& workers,
322 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source);
323 void ScheduleClearUserDataImpl();
324 320
325 // Returns true if the client is currently in exponential backoff. 321 // Returns true if the client is currently in exponential backoff.
326 bool IsBackingOff() const; 322 bool IsBackingOff() const;
327 323
328 // Helper to signal all listeners registered with |session_context_|. 324 // Helper to signal all listeners registered with |session_context_|.
329 void Notify(SyncEngineEvent::EventCause cause); 325 void Notify(SyncEngineEvent::EventCause cause);
330 326
331 // Callback to change backoff state. 327 // Callback to change backoff state.
332 void DoCanaryJob(); 328 void DoCanaryJob();
333 void Unthrottle(); 329 void Unthrottle();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 scoped_ptr<Syncer> syncer_; 406 scoped_ptr<Syncer> syncer_;
411 407
412 sessions::SyncSessionContext *session_context_; 408 sessions::SyncSessionContext *session_context_;
413 409
414 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); 410 DISALLOW_COPY_AND_ASSIGN(SyncScheduler);
415 }; 411 };
416 412
417 } // namespace browser_sync 413 } // namespace browser_sync
418 414
419 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ 415 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | sync/engine/sync_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698