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

Unified Diff: sync/engine/sync_scheduler.cc

Issue 10455012: [Sync] Add support for performing a GetKey on startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: sync/engine/sync_scheduler.cc
diff --git a/sync/engine/sync_scheduler.cc b/sync/engine/sync_scheduler.cc
index c351326e70ccf10769624a55f3710d5e51084aa3..9b26a02fa53a1881ce1d61914938817b038c115d 100644
--- a/sync/engine/sync_scheduler.cc
+++ b/sync/engine/sync_scheduler.cc
@@ -353,15 +353,10 @@ bool SyncScheduler::ScheduleConfiguration(const ConfigurationParams& params) {
&restricted_workers);
session_context_->set_routing_info(params.routing_info);
- if (params.keystore_key_status == ConfigurationParams::KEYSTORE_KEY_NEEDED) {
- // TODO(zea): implement in such a way that we can handle failures and the
- // subsequent retrys the scheduler might perform. See crbug.com/129665.
- NOTIMPLEMENTED();
- }
-
- // Only reconfigure if we have types to download.
- if (!params.types_to_download.Empty()) {
- DCHECK(!restricted_routes.empty());
+ // Only perform configure if we have types to download or need to download
+ // the encryption key.
+ if (params.keystore_key_status == ConfigurationParams::KEYSTORE_KEY_NEEDED ||
+ !params.types_to_download.Empty()) {
linked_ptr<SyncSession> session(new SyncSession(
session_context_,
this,
@@ -667,12 +662,23 @@ const char* SyncScheduler::GetDecisionString(
// static
void SyncScheduler::SetSyncerStepsForPurpose(
SyncSessionJob::SyncSessionJobPurpose purpose,
+ const ConfigurationParams& config_params,
SyncerStep* start,
SyncerStep* end) {
switch (purpose) {
case SyncSessionJob::CONFIGURATION:
- *start = DOWNLOAD_UPDATES;
- *end = APPLY_UPDATES;
+ DCHECK(config_params.keystore_key_status ==
+ ConfigurationParams::KEYSTORE_KEY_NEEDED ||
+ !config_params.types_to_download.Empty());
+ if (config_params.keystore_key_status ==
tim (not reviewing) 2012/07/19 21:42:03 If it's a separate http request, should we have a
Nicolas Zea 2012/07/24 22:51:24 Based on the discussion with Kevin, moved the GetK
+ ConfigurationParams::KEYSTORE_KEY_NEEDED)
+ *start = GET_ENCRYPTION_KEY;
+ else
+ *start = DOWNLOAD_UPDATES;
+ if (config_params.types_to_download.Empty())
+ *end = GET_ENCRYPTION_KEY;
+ else
+ *end = APPLY_UPDATES;
return;
case SyncSessionJob::NUDGE:
case SyncSessionJob::POLL:
@@ -767,7 +773,7 @@ void SyncScheduler::DoSyncSessionJob(const SyncSessionJob& job) {
SyncerStep begin(SYNCER_END);
SyncerStep end(SYNCER_END);
- SetSyncerStepsForPurpose(job.purpose, &begin, &end);
+ SetSyncerStepsForPurpose(job.purpose, job.config_params, &begin, &end);
bool has_more_to_sync = true;
while (ShouldRunJob(job) && has_more_to_sync) {

Powered by Google App Engine
This is Rietveld 408576698