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

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

Issue 23189021: sync: Gracefully handle very early shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Retry: sync non-blocking early shutdown Created 7 years, 3 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 | « sync/engine/net/server_connection_manager.cc ('k') | sync/engine/sync_scheduler_impl.h » ('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 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 // 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 8
9 #include <string> 9 #include <string>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // scheduled tasks from the old mode may still run. 68 // scheduled tasks from the old mode may still run.
69 virtual void Start(Mode mode) = 0; 69 virtual void Start(Mode mode) = 0;
70 70
71 // Schedules the configuration task specified by |params|. Returns true if 71 // Schedules the configuration task specified by |params|. Returns true if
72 // the configuration task executed immediately, false if it had to be 72 // the configuration task executed immediately, false if it had to be
73 // scheduled for a later attempt. |params.ready_task| is invoked whenever the 73 // scheduled for a later attempt. |params.ready_task| is invoked whenever the
74 // configuration task executes. 74 // configuration task executes.
75 // Note: must already be in CONFIGURATION mode. 75 // Note: must already be in CONFIGURATION mode.
76 virtual bool ScheduleConfiguration(const ConfigurationParams& params) = 0; 76 virtual bool ScheduleConfiguration(const ConfigurationParams& params) = 0;
77 77
78 // Request that any running syncer task stop as soon as possible and 78 // Request that the syncer avoid starting any new tasks and prepare for
79 // cancel all scheduled tasks. This function can be called from any thread, 79 // shutdown.
80 // and should in fact be called from a thread that isn't the sync loop to 80 virtual void Stop() = 0;
81 // allow preempting ongoing sync cycles.
82 virtual void RequestStop() = 0;
83 81
84 // The meat and potatoes. All three of the following methods will post a 82 // The meat and potatoes. All three of the following methods will post a
85 // delayed task to attempt the actual nudge (see ScheduleNudgeImpl). 83 // delayed task to attempt the actual nudge (see ScheduleNudgeImpl).
86 // 84 //
87 // NOTE: |desired_delay| is best-effort. If a nudge is already scheduled to 85 // NOTE: |desired_delay| is best-effort. If a nudge is already scheduled to
88 // depart earlier than Now() + delay, the scheduler can and will prefer to 86 // depart earlier than Now() + delay, the scheduler can and will prefer to
89 // batch the two so that only one nudge is sent (at the earlier time). Also, 87 // batch the two so that only one nudge is sent (at the earlier time). Also,
90 // as always with delayed tasks and timers, it's possible the task gets run 88 // as always with delayed tasks and timers, it's possible the task gets run
91 // any time after |desired_delay|. 89 // any time after |desired_delay|.
92 90
(...skipping 30 matching lines...) Expand all
123 // Called when credentials are updated by the user. 121 // Called when credentials are updated by the user.
124 virtual void OnCredentialsUpdated() = 0; 122 virtual void OnCredentialsUpdated() = 0;
125 123
126 // Called when the network layer detects a connection status change. 124 // Called when the network layer detects a connection status change.
127 virtual void OnConnectionStatusChange() = 0; 125 virtual void OnConnectionStatusChange() = 0;
128 }; 126 };
129 127
130 } // namespace syncer 128 } // namespace syncer
131 129
132 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ 130 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_
OLDNEW
« no previous file with comments | « sync/engine/net/server_connection_manager.cc ('k') | sync/engine/sync_scheduler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698