OLD | NEW |
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 #include "sync/engine/sync_scheduler.h" | 5 #include "sync/engine/sync_scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 bool IsActionableError( | 62 bool IsActionableError( |
63 const syncer::SyncProtocolError& error) { | 63 const syncer::SyncProtocolError& error) { |
64 return (error.action != syncer::UNKNOWN_ACTION); | 64 return (error.action != syncer::UNKNOWN_ACTION); |
65 } | 65 } |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 ConfigurationParams::ConfigurationParams() | 68 ConfigurationParams::ConfigurationParams() |
69 : source(GetUpdatesCallerInfo::UNKNOWN), | 69 : source(GetUpdatesCallerInfo::UNKNOWN) {} |
70 keystore_key_status(KEYSTORE_KEY_UNNECESSARY) {} | |
71 ConfigurationParams::ConfigurationParams( | 70 ConfigurationParams::ConfigurationParams( |
72 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, | 71 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, |
73 const syncer::ModelTypeSet& types_to_download, | 72 const syncer::ModelTypeSet& types_to_download, |
74 const syncer::ModelSafeRoutingInfo& routing_info, | 73 const syncer::ModelSafeRoutingInfo& routing_info, |
75 KeystoreKeyStatus keystore_key_status, | |
76 const base::Closure& ready_task) | 74 const base::Closure& ready_task) |
77 : source(source), | 75 : source(source), |
78 types_to_download(types_to_download), | 76 types_to_download(types_to_download), |
79 routing_info(routing_info), | 77 routing_info(routing_info), |
80 keystore_key_status(keystore_key_status), | |
81 ready_task(ready_task) { | 78 ready_task(ready_task) { |
82 DCHECK(!ready_task.is_null()); | 79 DCHECK(!ready_task.is_null()); |
83 } | 80 } |
84 ConfigurationParams::~ConfigurationParams() {} | 81 ConfigurationParams::~ConfigurationParams() {} |
85 | 82 |
86 SyncScheduler::DelayProvider::DelayProvider() {} | 83 SyncScheduler::DelayProvider::DelayProvider() {} |
87 SyncScheduler::DelayProvider::~DelayProvider() {} | 84 SyncScheduler::DelayProvider::~DelayProvider() {} |
88 | 85 |
89 SyncScheduler::WaitInterval::WaitInterval() | 86 SyncScheduler::WaitInterval::WaitInterval() |
90 : mode(UNKNOWN), | 87 : mode(UNKNOWN), |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 // crbug.com/133030 | 343 // crbug.com/133030 |
347 syncer::ModelSafeRoutingInfo restricted_routes; | 344 syncer::ModelSafeRoutingInfo restricted_routes; |
348 std::vector<ModelSafeWorker*> restricted_workers; | 345 std::vector<ModelSafeWorker*> restricted_workers; |
349 BuildModelSafeParams(params.types_to_download, | 346 BuildModelSafeParams(params.types_to_download, |
350 params.routing_info, | 347 params.routing_info, |
351 session_context_->workers(), | 348 session_context_->workers(), |
352 &restricted_routes, | 349 &restricted_routes, |
353 &restricted_workers); | 350 &restricted_workers); |
354 session_context_->set_routing_info(params.routing_info); | 351 session_context_->set_routing_info(params.routing_info); |
355 | 352 |
356 if (params.keystore_key_status == ConfigurationParams::KEYSTORE_KEY_NEEDED) { | 353 // Only perform configure if we have types to download. |
357 // TODO(zea): implement in such a way that we can handle failures and the | |
358 // subsequent retrys the scheduler might perform. See crbug.com/129665. | |
359 NOTIMPLEMENTED(); | |
360 } | |
361 | |
362 // Only reconfigure if we have types to download. | |
363 if (!params.types_to_download.Empty()) { | 354 if (!params.types_to_download.Empty()) { |
364 DCHECK(!restricted_routes.empty()); | |
365 linked_ptr<SyncSession> session(new SyncSession( | 355 linked_ptr<SyncSession> session(new SyncSession( |
366 session_context_, | 356 session_context_, |
367 this, | 357 this, |
368 SyncSourceInfo(params.source, | 358 SyncSourceInfo(params.source, |
369 ModelSafeRoutingInfoToPayloadMap( | 359 ModelSafeRoutingInfoToPayloadMap( |
370 restricted_routes, | 360 restricted_routes, |
371 std::string())), | 361 std::string())), |
372 restricted_routes, | 362 restricted_routes, |
373 restricted_workers)); | 363 restricted_workers)); |
374 SyncSessionJob job(SyncSessionJob::CONFIGURATION, | 364 SyncSessionJob job(SyncSessionJob::CONFIGURATION, |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 | 1142 |
1153 #undef SDVLOG_LOC | 1143 #undef SDVLOG_LOC |
1154 | 1144 |
1155 #undef SDVLOG | 1145 #undef SDVLOG |
1156 | 1146 |
1157 #undef SLOG | 1147 #undef SLOG |
1158 | 1148 |
1159 #undef ENUM_CASE | 1149 #undef ENUM_CASE |
1160 | 1150 |
1161 } // namespace syncer | 1151 } // namespace syncer |
OLD | NEW |