summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/public/sessions
diff options
context:
space:
mode:
authordharani@google.com <dharani@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-29 23:26:15 +0000
committerdharani@google.com <dharani@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-29 23:26:15 +0000
commit592ca89ecd826dac82b837e5e2085d8c3cfbe22e (patch)
treeb0c0be4da773910112aee3b572045b87cf51b1f4 /sync/internal_api/public/sessions
parente0e8fac17ff416ac0ff4e5bd11ed086b9cf52a44 (diff)
downloadchromium_src-592ca89ecd826dac82b837e5e2085d8c3cfbe22e.zip
chromium_src-592ca89ecd826dac82b837e5e2085d8c3cfbe22e.tar.gz
chromium_src-592ca89ecd826dac82b837e5e2085d8c3cfbe22e.tar.bz2
Revert 164565 - sync: make scheduling logic and job ownership more obvious.
Revert Reason - see bug 158313 - inlines (and removes) SaveJob, to perform only the relevant "saving" bits where needed. As it turns out, most of it was only necessary for ShouldRunJob (which I'd like to rename, as it's destructive), and it's a lot easier to read what's happening and why. Note also removed TODO at SaveJob callsites. - inlines (and removes) InitOrCoalescePendingJob to perform only the relevant bits at each callsite. - pulls SyncSessionJob into a class, to handle basic responsibilities that need the job Purpose + session (like "Succeeded()" and "Finish") that were previously strewn about and partially copy/pasted in the scheduler. - meticulously transfers ownership (removes linked_ptr usage!) of jobs instead of making many implicit struct copies, as it resulted in non-obvious behavior. To do this, ownership is given to the scheduling mechanism (the MessageLoop for ScheduleSyncSessionJob, WaitInterval::timer for canary jobs), instead of jobs sitting around without knowing whether they're scheduled or not. There are a few cases where we can't actually "schedule" a job -- which wasn't even obvious from the old code, and other interesting revelations, like fact that we were actually pre-empt nudge canary jobs and "unscheduling" them in certain cases. - removes DoPendingJobIfPossible, since it is no longer needed for DoCanaryJob/Unthrottle cases, and make the behavior more explicit in the other cases (mode-switch and SCM error change), see TakePendingJobForCurrentMode. - removes the ability to create jobs as canary, since this wasn't needed and was adding complexity (see DoCanaryJob / GrantCanaryPrivilege). - removes retry_scheduled as it wasn't used anywhere - adds lots of comments. Also discovered that THROTTLED intervals seem to never fire a canary job with today's code (broken), config jobs are immune to per-data-type throttling, and the had_nudge allowance was defeated by extra IsBackingOff check in ScheduleNudgeImpl (see comment on review). BUG= Review URL: https://chromiumcodereview.appspot.com/10917234 TBR=tim@chromium.org Review URL: https://codereview.chromium.org/11347027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/public/sessions')
-rw-r--r--sync/internal_api/public/sessions/model_neutral_state.cc8
-rw-r--r--sync/internal_api/public/sessions/model_neutral_state.h2
-rw-r--r--sync/internal_api/public/sessions/sync_session_snapshot.cc9
-rw-r--r--sync/internal_api/public/sessions/sync_session_snapshot.h5
4 files changed, 12 insertions, 12 deletions
diff --git a/sync/internal_api/public/sessions/model_neutral_state.cc b/sync/internal_api/public/sessions/model_neutral_state.cc
index c789dcc..c9caa75 100644
--- a/sync/internal_api/public/sessions/model_neutral_state.cc
+++ b/sync/internal_api/public/sessions/model_neutral_state.cc
@@ -30,13 +30,5 @@ ModelNeutralState::ModelNeutralState()
ModelNeutralState::~ModelNeutralState() {}
-bool HasSyncerError(const ModelNeutralState& state) {
- const bool get_key_error = SyncerErrorIsError(state.last_get_key_result);
- const bool download_updates_error =
- SyncerErrorIsError(state.last_download_updates_result);
- const bool commit_error = SyncerErrorIsError(state.commit_result);
- return get_key_error || download_updates_error || commit_error;
-}
-
} // namespace sessions
} // namespace syncer
diff --git a/sync/internal_api/public/sessions/model_neutral_state.h b/sync/internal_api/public/sessions/model_neutral_state.h
index 9644175..e291a25 100644
--- a/sync/internal_api/public/sessions/model_neutral_state.h
+++ b/sync/internal_api/public/sessions/model_neutral_state.h
@@ -75,8 +75,6 @@ struct ModelNeutralState {
int64 num_server_changes_remaining;
};
-bool HasSyncerError(const ModelNeutralState& state);
-
} // namespace sessions
} // namespace syncer
diff --git a/sync/internal_api/public/sessions/sync_session_snapshot.cc b/sync/internal_api/public/sessions/sync_session_snapshot.cc
index 193a5af..0f6fb01 100644
--- a/sync/internal_api/public/sessions/sync_session_snapshot.cc
+++ b/sync/internal_api/public/sessions/sync_session_snapshot.cc
@@ -21,6 +21,7 @@ SyncSessionSnapshot::SyncSessionSnapshot()
num_server_conflicts_(0),
notifications_enabled_(false),
num_entries_(0),
+ retry_scheduled_(false),
is_initialized_(false) {
}
@@ -38,7 +39,8 @@ SyncSessionSnapshot::SyncSessionSnapshot(
const SyncSourceInfo& source,
bool notifications_enabled,
size_t num_entries,
- base::Time sync_start_time)
+ base::Time sync_start_time,
+ bool retry_scheduled)
: model_neutral_state_(model_neutral_state),
is_share_usable_(is_share_usable),
initial_sync_ended_(initial_sync_ended),
@@ -53,6 +55,7 @@ SyncSessionSnapshot::SyncSessionSnapshot(
notifications_enabled_(notifications_enabled),
num_entries_(num_entries),
sync_start_time_(sync_start_time),
+ retry_scheduled_(retry_scheduled),
is_initialized_(true) {
}
@@ -165,6 +168,10 @@ base::Time SyncSessionSnapshot::sync_start_time() const {
return sync_start_time_;
}
+bool SyncSessionSnapshot::retry_scheduled() const {
+ return retry_scheduled_;
+}
+
bool SyncSessionSnapshot::is_initialized() const {
return is_initialized_;
}
diff --git a/sync/internal_api/public/sessions/sync_session_snapshot.h b/sync/internal_api/public/sessions/sync_session_snapshot.h
index d507517..16b0753 100644
--- a/sync/internal_api/public/sessions/sync_session_snapshot.h
+++ b/sync/internal_api/public/sessions/sync_session_snapshot.h
@@ -43,7 +43,8 @@ class SyncSessionSnapshot {
const SyncSourceInfo& source,
bool notifications_enabled,
size_t num_entries,
- base::Time sync_start_time);
+ base::Time sync_start_time,
+ bool retry_scheduled);
~SyncSessionSnapshot();
// Caller takes ownership of the returned dictionary.
@@ -68,6 +69,7 @@ class SyncSessionSnapshot {
bool notifications_enabled() const;
size_t num_entries() const;
base::Time sync_start_time() const;
+ bool retry_scheduled() const;
// Set iff this snapshot was not built using the default constructor.
bool is_initialized() const;
@@ -87,6 +89,7 @@ class SyncSessionSnapshot {
bool notifications_enabled_;
size_t num_entries_;
base::Time sync_start_time_;
+ bool retry_scheduled_;
bool is_initialized_;
};