OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/download.h" | 5 #include "sync/engine/download.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "sync/engine/process_updates_util.h" | 10 #include "sync/engine/process_updates_util.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 proto_request_types, | 227 proto_request_types, |
228 update_handler_map, | 228 update_handler_map, |
229 get_updates); | 229 get_updates); |
230 | 230 |
231 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. | 231 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. |
232 get_updates->mutable_caller_info()->set_source( | 232 get_updates->mutable_caller_info()->set_source( |
233 nudge_tracker.updates_source()); | 233 nudge_tracker.updates_source()); |
234 | 234 |
235 // Set the new and improved version of source, too. | 235 // Set the new and improved version of source, too. |
236 get_updates->set_get_updates_origin(sync_pb::SyncEnums::GU_TRIGGER); | 236 get_updates->set_get_updates_origin(sync_pb::SyncEnums::GU_TRIGGER); |
237 get_updates->set_is_retry(nudge_tracker.IsRetryRequired()); | |
rlarocque
2014/01/06 23:00:33
This is good, but I think this flag should also be
haitaol1
2014/01/07 19:03:37
origin == RETRY already indicates it's a retry GU,
rlarocque
2014/01/07 19:43:41
This would make the logic to detect retry GUs hard
haitaol1
2014/01/08 19:06:38
Done.
| |
237 | 238 |
238 // Fill in the notification hints. | 239 // Fill in the notification hints. |
239 for (int i = 0; i < get_updates->from_progress_marker_size(); ++i) { | 240 for (int i = 0; i < get_updates->from_progress_marker_size(); ++i) { |
240 sync_pb::DataTypeProgressMarker* progress_marker = | 241 sync_pb::DataTypeProgressMarker* progress_marker = |
241 get_updates->mutable_from_progress_marker(i); | 242 get_updates->mutable_from_progress_marker(i); |
242 ModelType type = GetModelTypeFromSpecificsFieldNumber( | 243 ModelType type = GetModelTypeFromSpecificsFieldNumber( |
243 progress_marker->data_type_id()); | 244 progress_marker->data_type_id()); |
244 | 245 |
245 DCHECK(!nudge_tracker.IsTypeThrottled(type)) | 246 DCHECK(!nudge_tracker.IsTypeThrottled(type)) |
246 << "Throttled types should have been removed from the request_types."; | 247 << "Throttled types should have been removed from the request_types."; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 | 288 |
288 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. | 289 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. |
289 get_updates->mutable_caller_info()->set_source(source); | 290 get_updates->mutable_caller_info()->set_source(source); |
290 | 291 |
291 // Set the new and improved version of source, too. | 292 // Set the new and improved version of source, too. |
292 sync_pb::SyncEnums::GetUpdatesOrigin origin = | 293 sync_pb::SyncEnums::GetUpdatesOrigin origin = |
293 ConvertConfigureSourceToOrigin(source); | 294 ConvertConfigureSourceToOrigin(source); |
294 get_updates->set_get_updates_origin(origin); | 295 get_updates->set_get_updates_origin(origin); |
295 } | 296 } |
296 | 297 |
297 void BuildDownloadUpdatesForPoll( | 298 void BuildSupplementDownloadUpdates( |
298 SyncSession* session, | 299 SyncSession* session, |
299 bool create_mobile_bookmarks_folder, | 300 bool create_mobile_bookmarks_folder, |
300 ModelTypeSet request_types, | 301 ModelTypeSet request_types, |
302 sync_pb::SyncEnums::GetUpdatesOrigin gu_origin, | |
301 sync_pb::ClientToServerMessage* client_to_server_message) { | 303 sync_pb::ClientToServerMessage* client_to_server_message) { |
302 DVLOG(1) << "Polling for types " | 304 DVLOG(1) << "Polling/Retrying for types " |
303 << ModelTypeSetToString(request_types); | 305 << ModelTypeSetToString(request_types); |
304 | 306 |
307 DCHECK(gu_origin == sync_pb::SyncEnums::PERIODIC || | |
308 gu_origin == sync_pb::SyncEnums::RETRY); | |
309 | |
305 InitDownloadUpdatesContext( | 310 InitDownloadUpdatesContext( |
306 session, | 311 session, |
307 create_mobile_bookmarks_folder, | 312 create_mobile_bookmarks_folder, |
308 client_to_server_message); | 313 client_to_server_message); |
309 BuildDownloadUpdatesForPollImpl( | 314 BuildSupplementDownloadUpdatesImpl( |
310 Intersection(request_types, ProtocolTypes()), | 315 Intersection(request_types, ProtocolTypes()), |
316 gu_origin, | |
311 session->context()->update_handler_map(), | 317 session->context()->update_handler_map(), |
312 client_to_server_message->mutable_get_updates()); | 318 client_to_server_message->mutable_get_updates()); |
313 } | 319 } |
314 | 320 |
315 void BuildDownloadUpdatesForPollImpl( | 321 void BuildSupplementDownloadUpdatesImpl( |
rlarocque
2014/01/06 23:00:33
I realize this is a bit subjective, but I think th
haitaol1
2014/01/07 19:03:37
Done.
| |
316 ModelTypeSet proto_request_types, | 322 ModelTypeSet proto_request_types, |
323 sync_pb::SyncEnums::GetUpdatesOrigin gu_origin, | |
317 UpdateHandlerMap* update_handler_map, | 324 UpdateHandlerMap* update_handler_map, |
318 sync_pb::GetUpdatesMessage* get_updates) { | 325 sync_pb::GetUpdatesMessage* get_updates) { |
319 DCHECK(!proto_request_types.Empty()); | 326 DCHECK(!proto_request_types.Empty()); |
320 | 327 |
321 InitDownloadUpdatesProgress( | 328 InitDownloadUpdatesProgress( |
322 proto_request_types, | 329 proto_request_types, |
323 update_handler_map, | 330 update_handler_map, |
324 get_updates); | 331 get_updates); |
325 | 332 |
326 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. | 333 // Set the new and improved version of source as well as the legacy |
327 get_updates->mutable_caller_info()->set_source( | 334 // GetUpdatesMessage.GetUpdatesCallerInfo information. |
328 sync_pb::GetUpdatesCallerInfo::PERIODIC); | 335 get_updates->set_get_updates_origin(gu_origin); |
329 | 336 if (gu_origin == sync_pb::SyncEnums::PERIODIC) { |
330 // Set the new and improved version of source, too. | 337 get_updates->mutable_caller_info()->set_source( |
331 get_updates->set_get_updates_origin(sync_pb::SyncEnums::PERIODIC); | 338 sync_pb::GetUpdatesCallerInfo::PERIODIC); |
339 } else { | |
340 get_updates->mutable_caller_info()->set_source( | |
341 sync_pb::GetUpdatesCallerInfo::RETRY); | |
342 } | |
332 } | 343 } |
333 | 344 |
334 SyncerError ExecuteDownloadUpdates( | 345 SyncerError ExecuteDownloadUpdates( |
335 ModelTypeSet request_types, | 346 ModelTypeSet request_types, |
336 SyncSession* session, | 347 SyncSession* session, |
337 sync_pb::ClientToServerMessage* msg) { | 348 sync_pb::ClientToServerMessage* msg) { |
338 sync_pb::ClientToServerResponse update_response; | 349 sync_pb::ClientToServerResponse update_response; |
339 StatusController* status = session->mutable_status_controller(); | 350 StatusController* status = session->mutable_status_controller(); |
340 bool need_encryption_key = ShouldRequestEncryptionKey(session->context()); | 351 bool need_encryption_key = ShouldRequestEncryptionKey(session->context()); |
341 | 352 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 void CopyClientDebugInfo( | 428 void CopyClientDebugInfo( |
418 sessions::DebugInfoGetter* debug_info_getter, | 429 sessions::DebugInfoGetter* debug_info_getter, |
419 sync_pb::DebugInfo* debug_info) { | 430 sync_pb::DebugInfo* debug_info) { |
420 DVLOG(1) << "Copying client debug info to send."; | 431 DVLOG(1) << "Copying client debug info to send."; |
421 debug_info_getter->GetDebugInfo(debug_info); | 432 debug_info_getter->GetDebugInfo(debug_info); |
422 } | 433 } |
423 | 434 |
424 } // namespace download | 435 } // namespace download |
425 | 436 |
426 } // namespace syncer | 437 } // namespace syncer |
OLD | NEW |