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

Side by Side Diff: chrome/browser/sync/profile_sync_service_harness.cc

Issue 10210009: sync: Loop committing items without downloading updates (v2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Inline PostCommitMessageCommand 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 | « no previous file | chrome/browser/sync/test_profile_sync_service.cc » ('j') | sync/engine/commit.cc » ('J')
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 "chrome/browser/sync/profile_sync_service_harness.h" 5 #include "chrome/browser/sync/profile_sync_service_harness.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <iterator> 8 #include <iterator>
9 #include <ostream> 9 #include <ostream>
10 #include <set> 10 #include <set>
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 is_data_synced ? "IsDataSynced: true" : "IsDataSynced: false"); 772 is_data_synced ? "IsDataSynced: true" : "IsDataSynced: false");
773 return is_data_synced; 773 return is_data_synced;
774 } 774 }
775 775
776 bool ProfileSyncServiceHarness::IsFullySynced() { 776 bool ProfileSyncServiceHarness::IsFullySynced() {
777 if (service() == NULL) { 777 if (service() == NULL) {
778 DVLOG(1) << GetClientInfoString("IsFullySynced: false"); 778 DVLOG(1) << GetClientInfoString("IsFullySynced: false");
779 return false; 779 return false;
780 } 780 }
781 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); 781 const SyncSessionSnapshot& snap = GetLastSessionSnapshot();
782 // snap.unsynced_count() == 0 is a fairly reliable indicator of whether or not 782 // If we didn't try to commit anything in the previous cycle, there's a
783 // our timestamp is in sync with the server. 783 // good chance that we're now fully up to date.
784 bool is_fully_synced = IsDataSyncedImpl(snap) && 784 bool is_fully_synced =
785 snap.unsynced_count() == 0; 785 (snap.errors().last_post_commit_result == browser_sync::UNSET)
786 && IsDataSyncedImpl(snap);
786 787
787 DVLOG(1) << GetClientInfoString( 788 DVLOG(1) << GetClientInfoString(
788 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false"); 789 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false");
789 return is_fully_synced; 790 return is_fully_synced;
790 } 791 }
791 792
792 bool ProfileSyncServiceHarness::HasPendingBackendMigration() { 793 bool ProfileSyncServiceHarness::HasPendingBackendMigration() {
793 browser_sync::BackendMigrator* migrator = 794 browser_sync::BackendMigrator* migrator =
794 service()->GetBackendMigratorForTest(); 795 service()->GetBackendMigratorForTest();
795 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE; 796 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 std::stringstream os; 979 std::stringstream os;
979 os << profile_debug_name_ << ": " << message << ": "; 980 os << profile_debug_name_ << ": " << message << ": ";
980 if (service()) { 981 if (service()) {
981 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); 982 const SyncSessionSnapshot& snap = GetLastSessionSnapshot();
982 const ProfileSyncService::Status& status = GetStatus(); 983 const ProfileSyncService::Status& status = GetStatus();
983 // Capture select info from the sync session snapshot and syncer status. 984 // Capture select info from the sync session snapshot and syncer status.
984 os << "has_more_to_sync: " 985 os << "has_more_to_sync: "
985 << snap.has_more_to_sync() 986 << snap.has_more_to_sync()
986 << ", has_unsynced_items: " 987 << ", has_unsynced_items: "
987 << service()->HasUnsyncedItems() 988 << service()->HasUnsyncedItems()
988 << ", unsynced_count: "
989 << snap.unsynced_count()
990 << ", encryption conflicts: " 989 << ", encryption conflicts: "
991 << snap.num_encryption_conflicts() 990 << snap.num_encryption_conflicts()
992 << ", hierarchy conflicts: " 991 << ", hierarchy conflicts: "
993 << snap.num_hierarchy_conflicts() 992 << snap.num_hierarchy_conflicts()
994 << ", simple conflicts: " 993 << ", simple conflicts: "
995 << snap.num_simple_conflicts() 994 << snap.num_simple_conflicts()
996 << ", server conflicts: " 995 << ", server conflicts: "
997 << snap.num_server_conflicts() 996 << snap.num_server_conflicts()
998 << ", num_updates_downloaded : " 997 << ", num_updates_downloaded : "
999 << snap.syncer_status().num_updates_downloaded_total 998 << snap.syncer_status().num_updates_downloaded_total
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 1091
1093 std::string ProfileSyncServiceHarness::GetServiceStatus() { 1092 std::string ProfileSyncServiceHarness::GetServiceStatus() {
1094 DictionaryValue value; 1093 DictionaryValue value;
1095 sync_ui_util::ConstructAboutInformation(service_, &value); 1094 sync_ui_util::ConstructAboutInformation(service_, &value);
1096 std::string service_status; 1095 std::string service_status;
1097 base::JSONWriter::WriteWithOptions(&value, 1096 base::JSONWriter::WriteWithOptions(&value,
1098 base::JSONWriter::OPTIONS_PRETTY_PRINT, 1097 base::JSONWriter::OPTIONS_PRETTY_PRINT,
1099 &service_status); 1098 &service_status);
1100 return service_status; 1099 return service_status;
1101 } 1100 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/test_profile_sync_service.cc » ('j') | sync/engine/commit.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698