DescriptionCall batch/incremental fetch with more strict conditions
- Deprecate is_fetching_changes_ flag
- Add a new flag: may_have_unfetched_changes_ which is turned on
at the beginning and when an event is fired
- Call StartBatchSyncForOrigin() and FetchChangesForIncrementalSync()
only from MaybeStartFetchTask() with more strict conditions.
Partialy integrating the change proposal made by tzik:
https://codereview.chromium.org/12221088/
* It ALWAYS sets may_have_unfetched_changes_ true and call MaybeStartFetchTask()
in XMPP/Timer/Auth/Network event handlers, so it has to be able to kick
StartBatchSyncForOrigin() or FetchChangesForIncrementalSync() whenever an
event happens even if the service state is in TEMPORARY_UNAVAILABLE.
* It ALWAYS sets may_have_unfetched_changes_ false in StartBatchSyncForOrigin()
and FetchChangesForIncrementalSync(), so that it won't get stuck in an infinite
loop calling one of the methods again and again when the service state is
TEMPORARY_UNAVAILABLE (e.g. network is offline).
* It does NOT queue fetch tasks to the pending_tasks_ when another task is
running, so the service has not to be overloaded by unifinished pending fetch
tasks.
* NotifyTaskDone() ALWAYS calls SchedulePolling() (which starts the timer
if it hasn't been started) so it should not miss the tminigs where one of
fetch-change methods have to be called.
== State transition map:
{ OK, !batch.empty(), _ }
-> NotifyTaskDone() calls StartBatchSyncForOrigin() until batch.empty() becomes true
{ TEMPORARY_UNAVAILABLE, !batch.empty(), _ }
-> NotifyTaskDone() calls nothing
-> XMPP/Timer/Auth/Network event handler calls StartBatchSyncForOrigin() if no task is running, otherwise let NotifyTaskDone() call it at most once
{ !DISABLED, batch.empty(), !incremental.empty() }
-> NotifyTaskDone() calls nothing
-> XMPP/Timer/Auth/Network event handler calls FetchChangesForIncrementalSync() if no task is running, otherwise let NotifyTaskDone() call it at most once
BUG=175047
TEST=manual
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=181851
Patch Set 1 #Patch Set 2 : test fixes #
Messages
Total messages: 3 (0 generated)
|