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

Side by Side Diff: sync/engine/download.cc

Issue 124083002: Client-side changes to support retry GU. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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()));
237 239
238 // Fill in the notification hints. 240 // Fill in the notification hints.
239 for (int i = 0; i < get_updates->from_progress_marker_size(); ++i) { 241 for (int i = 0; i < get_updates->from_progress_marker_size(); ++i) {
240 sync_pb::DataTypeProgressMarker* progress_marker = 242 sync_pb::DataTypeProgressMarker* progress_marker =
241 get_updates->mutable_from_progress_marker(i); 243 get_updates->mutable_from_progress_marker(i);
242 ModelType type = GetModelTypeFromSpecificsFieldNumber( 244 ModelType type = GetModelTypeFromSpecificsFieldNumber(
243 progress_marker->data_type_id()); 245 progress_marker->data_type_id());
244 246
245 DCHECK(!nudge_tracker.IsTypeThrottled(type)) 247 DCHECK(!nudge_tracker.IsTypeThrottled(type))
246 << "Throttled types should have been removed from the request_types."; 248 << "Throttled types should have been removed from the request_types.";
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 get_updates); 326 get_updates);
325 327
326 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. 328 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information.
327 get_updates->mutable_caller_info()->set_source( 329 get_updates->mutable_caller_info()->set_source(
328 sync_pb::GetUpdatesCallerInfo::PERIODIC); 330 sync_pb::GetUpdatesCallerInfo::PERIODIC);
329 331
330 // Set the new and improved version of source, too. 332 // Set the new and improved version of source, too.
331 get_updates->set_get_updates_origin(sync_pb::SyncEnums::PERIODIC); 333 get_updates->set_get_updates_origin(sync_pb::SyncEnums::PERIODIC);
332 } 334 }
333 335
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
334 SyncerError ExecuteDownloadUpdates( 374 SyncerError ExecuteDownloadUpdates(
335 ModelTypeSet request_types, 375 ModelTypeSet request_types,
336 SyncSession* session, 376 SyncSession* session,
337 sync_pb::ClientToServerMessage* msg) { 377 sync_pb::ClientToServerMessage* msg) {
338 sync_pb::ClientToServerResponse update_response; 378 sync_pb::ClientToServerResponse update_response;
339 StatusController* status = session->mutable_status_controller(); 379 StatusController* status = session->mutable_status_controller();
340 bool need_encryption_key = ShouldRequestEncryptionKey(session->context()); 380 bool need_encryption_key = ShouldRequestEncryptionKey(session->context());
341 381
342 if (session->context()->debug_info_getter()) { 382 if (session->context()->debug_info_getter()) {
343 sync_pb::DebugInfo* debug_info = msg->mutable_debug_info(); 383 sync_pb::DebugInfo* debug_info = msg->mutable_debug_info();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void CopyClientDebugInfo( 457 void CopyClientDebugInfo(
418 sessions::DebugInfoGetter* debug_info_getter, 458 sessions::DebugInfoGetter* debug_info_getter,
419 sync_pb::DebugInfo* debug_info) { 459 sync_pb::DebugInfo* debug_info) {
420 DVLOG(1) << "Copying client debug info to send."; 460 DVLOG(1) << "Copying client debug info to send.";
421 debug_info_getter->GetDebugInfo(debug_info); 461 debug_info_getter->GetDebugInfo(debug_info);
422 } 462 }
423 463
424 } // namespace download 464 } // namespace download
425 465
426 } // namespace syncer 466 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698