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( | |
238 nudge_tracker.IsRetryRequired(base::TimeTicks::Now())); | |
239 | 237 |
240 // Fill in the notification hints. | 238 // Fill in the notification hints. |
241 for (int i = 0; i < get_updates->from_progress_marker_size(); ++i) { | 239 for (int i = 0; i < get_updates->from_progress_marker_size(); ++i) { |
242 sync_pb::DataTypeProgressMarker* progress_marker = | 240 sync_pb::DataTypeProgressMarker* progress_marker = |
243 get_updates->mutable_from_progress_marker(i); | 241 get_updates->mutable_from_progress_marker(i); |
244 ModelType type = GetModelTypeFromSpecificsFieldNumber( | 242 ModelType type = GetModelTypeFromSpecificsFieldNumber( |
245 progress_marker->data_type_id()); | 243 progress_marker->data_type_id()); |
246 | 244 |
247 DCHECK(!nudge_tracker.IsTypeThrottled(type)) | 245 DCHECK(!nudge_tracker.IsTypeThrottled(type)) |
248 << "Throttled types should have been removed from the request_types."; | 246 << "Throttled types should have been removed from the request_types."; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 get_updates); | 324 get_updates); |
327 | 325 |
328 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. | 326 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. |
329 get_updates->mutable_caller_info()->set_source( | 327 get_updates->mutable_caller_info()->set_source( |
330 sync_pb::GetUpdatesCallerInfo::PERIODIC); | 328 sync_pb::GetUpdatesCallerInfo::PERIODIC); |
331 | 329 |
332 // Set the new and improved version of source, too. | 330 // Set the new and improved version of source, too. |
333 get_updates->set_get_updates_origin(sync_pb::SyncEnums::PERIODIC); | 331 get_updates->set_get_updates_origin(sync_pb::SyncEnums::PERIODIC); |
334 } | 332 } |
335 | 333 |
336 void BuildDownloadUpdatesForRetry( | |
337 SyncSession* session, | |
338 bool create_mobile_bookmarks_folder, | |
339 ModelTypeSet request_types, | |
340 sync_pb::ClientToServerMessage* client_to_server_message) { | |
341 DVLOG(1) << "Retrying for types " | |
342 << ModelTypeSetToString(request_types); | |
343 | |
344 InitDownloadUpdatesContext( | |
345 session, | |
346 create_mobile_bookmarks_folder, | |
347 client_to_server_message); | |
348 BuildDownloadUpdatesForRetryImpl( | |
349 Intersection(request_types, ProtocolTypes()), | |
350 session->context()->update_handler_map(), | |
351 client_to_server_message->mutable_get_updates()); | |
352 } | |
353 | |
354 void BuildDownloadUpdatesForRetryImpl( | |
355 ModelTypeSet proto_request_types, | |
356 UpdateHandlerMap* update_handler_map, | |
357 sync_pb::GetUpdatesMessage* get_updates) { | |
358 DCHECK(!proto_request_types.Empty()); | |
359 | |
360 InitDownloadUpdatesProgress( | |
361 proto_request_types, | |
362 update_handler_map, | |
363 get_updates); | |
364 | |
365 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. | |
366 get_updates->mutable_caller_info()->set_source( | |
367 sync_pb::GetUpdatesCallerInfo::RETRY); | |
368 | |
369 // Set the new and improved version of source, too. | |
370 get_updates->set_get_updates_origin(sync_pb::SyncEnums::RETRY); | |
371 get_updates->set_is_retry(true); | |
372 } | |
373 | |
374 SyncerError ExecuteDownloadUpdates( | 334 SyncerError ExecuteDownloadUpdates( |
375 ModelTypeSet request_types, | 335 ModelTypeSet request_types, |
376 SyncSession* session, | 336 SyncSession* session, |
377 sync_pb::ClientToServerMessage* msg) { | 337 sync_pb::ClientToServerMessage* msg) { |
378 sync_pb::ClientToServerResponse update_response; | 338 sync_pb::ClientToServerResponse update_response; |
379 StatusController* status = session->mutable_status_controller(); | 339 StatusController* status = session->mutable_status_controller(); |
380 bool need_encryption_key = ShouldRequestEncryptionKey(session->context()); | 340 bool need_encryption_key = ShouldRequestEncryptionKey(session->context()); |
381 | 341 |
382 if (session->context()->debug_info_getter()) { | 342 if (session->context()->debug_info_getter()) { |
383 sync_pb::DebugInfo* debug_info = msg->mutable_debug_info(); | 343 sync_pb::DebugInfo* debug_info = msg->mutable_debug_info(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 void CopyClientDebugInfo( | 417 void CopyClientDebugInfo( |
458 sessions::DebugInfoGetter* debug_info_getter, | 418 sessions::DebugInfoGetter* debug_info_getter, |
459 sync_pb::DebugInfo* debug_info) { | 419 sync_pb::DebugInfo* debug_info) { |
460 DVLOG(1) << "Copying client debug info to send."; | 420 DVLOG(1) << "Copying client debug info to send."; |
461 debug_info_getter->GetDebugInfo(debug_info); | 421 debug_info_getter->GetDebugInfo(debug_info); |
462 } | 422 } |
463 | 423 |
464 } // namespace download | 424 } // namespace download |
465 | 425 |
466 } // namespace syncer | 426 } // namespace syncer |
OLD | NEW |