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

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

Issue 10107004: Revert 132455 - Abort sync cycles when download step fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « sync/engine/sync_scheduler.h ('k') | sync/engine/syncer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 const char* SyncScheduler::GetDecisionString( 676 const char* SyncScheduler::GetDecisionString(
677 SyncScheduler::JobProcessDecision mode) { 677 SyncScheduler::JobProcessDecision mode) {
678 switch (mode) { 678 switch (mode) {
679 ENUM_CASE(CONTINUE); 679 ENUM_CASE(CONTINUE);
680 ENUM_CASE(SAVE); 680 ENUM_CASE(SAVE);
681 ENUM_CASE(DROP); 681 ENUM_CASE(DROP);
682 } 682 }
683 return ""; 683 return "";
684 } 684 }
685 685
686 // static
687 void SyncScheduler::SetSyncerStepsForPurpose(
688 SyncSessionJob::SyncSessionJobPurpose purpose,
689 SyncerStep* start,
690 SyncerStep* end) {
691 switch (purpose) {
692 case SyncSessionJob::CONFIGURATION:
693 *start = DOWNLOAD_UPDATES;
694 *end = APPLY_UPDATES;
695 return;
696 case SyncSessionJob::CLEAR_USER_DATA:
697 *start = CLEAR_PRIVATE_DATA;
698 *end = CLEAR_PRIVATE_DATA;
699 return;
700 case SyncSessionJob::NUDGE:
701 case SyncSessionJob::POLL:
702 *start = SYNCER_BEGIN;
703 *end = SYNCER_END;
704 return;
705 case SyncSessionJob::CLEANUP_DISABLED_TYPES:
706 *start = CLEANUP_DISABLED_TYPES;
707 *end = CLEANUP_DISABLED_TYPES;
708 return;
709 default:
710 NOTREACHED();
711 *start = SYNCER_END;
712 *end = SYNCER_END;
713 return;
714 }
715 }
716
717 void SyncScheduler::PostTask( 686 void SyncScheduler::PostTask(
718 const tracked_objects::Location& from_here, 687 const tracked_objects::Location& from_here,
719 const char* name, const base::Closure& task) { 688 const char* name, const base::Closure& task) {
720 SDVLOG_LOC(from_here, 3) << "Posting " << name << " task"; 689 SDVLOG_LOC(from_here, 3) << "Posting " << name << " task";
721 DCHECK_EQ(MessageLoop::current(), sync_loop_); 690 DCHECK_EQ(MessageLoop::current(), sync_loop_);
722 if (!started_) { 691 if (!started_) {
723 SDVLOG(1) << "Not posting task as scheduler is stopped."; 692 SDVLOG(1) << "Not posting task as scheduler is stopped.";
724 return; 693 return;
725 } 694 }
726 sync_loop_->PostTask(from_here, task); 695 sync_loop_->PostTask(from_here, task);
(...skipping 28 matching lines...) Expand all
755 job.session); 724 job.session);
756 pending_nudge_.reset(new SyncSessionJob(job)); 725 pending_nudge_.reset(new SyncSessionJob(job));
757 } 726 }
758 PostDelayedTask(job.from_here, "DoSyncSessionJob", 727 PostDelayedTask(job.from_here, "DoSyncSessionJob",
759 base::Bind(&SyncScheduler::DoSyncSessionJob, 728 base::Bind(&SyncScheduler::DoSyncSessionJob,
760 weak_ptr_factory_.GetWeakPtr(), 729 weak_ptr_factory_.GetWeakPtr(),
761 job), 730 job),
762 delay); 731 delay);
763 } 732 }
764 733
734 void SyncScheduler::SetSyncerStepsForPurpose(
735 SyncSessionJob::SyncSessionJobPurpose purpose,
736 SyncerStep* start, SyncerStep* end) {
737 DCHECK_EQ(MessageLoop::current(), sync_loop_);
738 switch (purpose) {
739 case SyncSessionJob::CONFIGURATION:
740 *start = DOWNLOAD_UPDATES;
741 *end = APPLY_UPDATES;
742 return;
743 case SyncSessionJob::CLEAR_USER_DATA:
744 *start = CLEAR_PRIVATE_DATA;
745 *end = CLEAR_PRIVATE_DATA;
746 return;
747 case SyncSessionJob::NUDGE:
748 case SyncSessionJob::POLL:
749 *start = SYNCER_BEGIN;
750 *end = SYNCER_END;
751 return;
752 case SyncSessionJob::CLEANUP_DISABLED_TYPES:
753 *start = CLEANUP_DISABLED_TYPES;
754 *end = CLEANUP_DISABLED_TYPES;
755 return;
756 default:
757 NOTREACHED();
758 *start = SYNCER_END;
759 *end = SYNCER_END;
760 return;
761 }
762 }
763
765 void SyncScheduler::DoSyncSessionJob(const SyncSessionJob& job) { 764 void SyncScheduler::DoSyncSessionJob(const SyncSessionJob& job) {
766 DCHECK_EQ(MessageLoop::current(), sync_loop_); 765 DCHECK_EQ(MessageLoop::current(), sync_loop_);
767 if (!ShouldRunJob(job)) { 766 if (!ShouldRunJob(job)) {
768 SLOG(WARNING) 767 SLOG(WARNING)
769 << "Not executing " 768 << "Not executing "
770 << SyncSessionJob::GetPurposeString(job.purpose) << " job from " 769 << SyncSessionJob::GetPurposeString(job.purpose) << " job from "
771 << GetUpdatesSourceString(job.session->source().updates_source); 770 << GetUpdatesSourceString(job.session->source().updates_source);
772 return; 771 return;
773 } 772 }
774 773
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 1196
1198 #undef SDVLOG_LOC 1197 #undef SDVLOG_LOC
1199 1198
1200 #undef SDVLOG 1199 #undef SDVLOG
1201 1200
1202 #undef SLOG 1201 #undef SLOG
1203 1202
1204 #undef ENUM_CASE 1203 #undef ENUM_CASE
1205 1204
1206 } // browser_sync 1205 } // browser_sync
OLDNEW
« no previous file with comments | « sync/engine/sync_scheduler.h ('k') | sync/engine/syncer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698