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

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: Rebase Created 8 years, 6 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/sync_ui_util.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 "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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 is_data_synced ? "IsDataSynced: true" : "IsDataSynced: false"); 785 is_data_synced ? "IsDataSynced: true" : "IsDataSynced: false");
786 return is_data_synced; 786 return is_data_synced;
787 } 787 }
788 788
789 bool ProfileSyncServiceHarness::IsFullySynced() { 789 bool ProfileSyncServiceHarness::IsFullySynced() {
790 if (service() == NULL) { 790 if (service() == NULL) {
791 DVLOG(1) << GetClientInfoString("IsFullySynced: false"); 791 DVLOG(1) << GetClientInfoString("IsFullySynced: false");
792 return false; 792 return false;
793 } 793 }
794 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); 794 const SyncSessionSnapshot& snap = GetLastSessionSnapshot();
795 // snap.unsynced_count() == 0 is a fairly reliable indicator of whether or not 795 // If we didn't try to commit anything in the previous cycle, there's a
796 // our timestamp is in sync with the server. 796 // good chance that we're now fully up to date.
797 bool is_fully_synced = IsDataSyncedImpl(snap) && 797 bool is_fully_synced =
798 snap.unsynced_count() == 0; 798 (snap.errors().last_post_commit_result == browser_sync::UNSET)
799 && IsDataSyncedImpl(snap);
799 800
800 DVLOG(1) << GetClientInfoString( 801 DVLOG(1) << GetClientInfoString(
801 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false"); 802 is_fully_synced ? "IsFullySynced: true" : "IsFullySynced: false");
802 return is_fully_synced; 803 return is_fully_synced;
803 } 804 }
804 805
805 bool ProfileSyncServiceHarness::HasPendingBackendMigration() { 806 bool ProfileSyncServiceHarness::HasPendingBackendMigration() {
806 browser_sync::BackendMigrator* migrator = 807 browser_sync::BackendMigrator* migrator =
807 service()->GetBackendMigratorForTest(); 808 service()->GetBackendMigratorForTest();
808 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE; 809 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 std::stringstream os; 992 std::stringstream os;
992 os << profile_debug_name_ << ": " << message << ": "; 993 os << profile_debug_name_ << ": " << message << ": ";
993 if (service()) { 994 if (service()) {
994 const SyncSessionSnapshot& snap = GetLastSessionSnapshot(); 995 const SyncSessionSnapshot& snap = GetLastSessionSnapshot();
995 const ProfileSyncService::Status& status = GetStatus(); 996 const ProfileSyncService::Status& status = GetStatus();
996 // Capture select info from the sync session snapshot and syncer status. 997 // Capture select info from the sync session snapshot and syncer status.
997 os << "has_more_to_sync: " 998 os << "has_more_to_sync: "
998 << snap.has_more_to_sync() 999 << snap.has_more_to_sync()
999 << ", has_unsynced_items: " 1000 << ", has_unsynced_items: "
1000 << (service()->sync_initialized() ? service()->HasUnsyncedItems() : 0) 1001 << (service()->sync_initialized() ? service()->HasUnsyncedItems() : 0)
1001 << ", unsynced_count: "
1002 << snap.unsynced_count()
1003 << ", encryption conflicts: " 1002 << ", encryption conflicts: "
1004 << snap.num_encryption_conflicts() 1003 << snap.num_encryption_conflicts()
1005 << ", hierarchy conflicts: " 1004 << ", hierarchy conflicts: "
1006 << snap.num_hierarchy_conflicts() 1005 << snap.num_hierarchy_conflicts()
1007 << ", simple conflicts: " 1006 << ", simple conflicts: "
1008 << snap.num_simple_conflicts() 1007 << snap.num_simple_conflicts()
1009 << ", server conflicts: " 1008 << ", server conflicts: "
1010 << snap.num_server_conflicts() 1009 << snap.num_server_conflicts()
1011 << ", num_updates_downloaded : " 1010 << ", num_updates_downloaded : "
1012 << snap.syncer_status().num_updates_downloaded_total 1011 << snap.syncer_status().num_updates_downloaded_total
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 1104
1106 std::string ProfileSyncServiceHarness::GetServiceStatus() { 1105 std::string ProfileSyncServiceHarness::GetServiceStatus() {
1107 DictionaryValue value; 1106 DictionaryValue value;
1108 sync_ui_util::ConstructAboutInformation(service_, &value); 1107 sync_ui_util::ConstructAboutInformation(service_, &value);
1109 std::string service_status; 1108 std::string service_status;
1110 base::JSONWriter::WriteWithOptions(&value, 1109 base::JSONWriter::WriteWithOptions(&value,
1111 base::JSONWriter::OPTIONS_PRETTY_PRINT, 1110 base::JSONWriter::OPTIONS_PRETTY_PRINT,
1112 &service_status); 1111 &service_status);
1113 return service_status; 1112 return service_status;
1114 } 1113 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/sync_ui_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698