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

Unified Diff: chrome/browser/sync/engine/all_status.cc

Issue 9323015: [Sync] - In about:sync page display if the first sync after restart has taken place or not. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/engine/all_status.cc
diff --git a/chrome/browser/sync/engine/all_status.cc b/chrome/browser/sync/engine/all_status.cc
index 374c0d35a42050e0c8944af7675a2aae7e400956..8a8ed40b9e6dcf55cfb42a15f127edd7ef1dad60 100644
--- a/chrome/browser/sync/engine/all_status.cc
+++ b/chrome/browser/sync/engine/all_status.cc
@@ -17,8 +17,7 @@
namespace browser_sync {
AllStatus::AllStatus() {
- status_.summary = sync_api::SyncManager::Status::OFFLINE;
- status_.initial_sync_ended = true;
+ status_.summary = sync_api::SyncManager::Status::UNININITIALIZED;
status_.notifications_enabled = false;
status_.cryptographer_ready = false;
status_.crypto_has_pending_keys = false;
@@ -34,7 +33,6 @@ sync_api::SyncManager::Status AllStatus::CreateBlankStatus() const {
sync_api::SyncManager::Status status = status_;
status.unsynced_count = 0;
status.conflicting_count = 0;
- status.initial_sync_ended = false;
rlarocque 2012/02/02 22:44:13 How is this change related to the intentions descr
lipalani1 2012/02/03 01:55:39 I thought about it some more. I had few reasons fo
status.max_consecutive_errors = 0;
status.updates_available = 0;
return status;
@@ -56,8 +54,6 @@ sync_api::SyncManager::Status AllStatus::CalcSyncing(
status.syncing = false;
}
- status.initial_sync_ended |= snapshot->is_share_usable;
-
const sessions::ErrorCounters& errors(snapshot->errors);
if (errors.consecutive_errors > status.max_consecutive_errors)
status.max_consecutive_errors = errors.consecutive_errors;
@@ -69,6 +65,7 @@ sync_api::SyncManager::Status AllStatus::CalcSyncing(
// TODO(ncarter): Make this realtime by having the syncer_status
// counter preserve its value across sessions. http://crbug.com/26339
if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) {
+ ++status.sync_count;
status.updates_received +=
snapshot->syncer_status.num_updates_downloaded_total;
status.tombstone_updates_received +=
@@ -94,19 +91,17 @@ sync_api::SyncManager::Status AllStatus::CalcSyncing(
void AllStatus::CalcStatusChanges() {
const bool unsynced_changes = status_.unsynced_count > 0;
- const bool online = status_.authenticated &&
+ const bool online = status_.sync_count > 0 && status_.authenticated &&
status_.server_reachable && status_.server_up;
if (online) {
if (status_.syncing)
status_.summary = sync_api::SyncManager::Status::SYNCING;
else
status_.summary = sync_api::SyncManager::Status::READY;
- } else if (!status_.initial_sync_ended) {
- status_.summary = sync_api::SyncManager::Status::OFFLINE_UNUSABLE;
} else if (unsynced_changes) {
status_.summary = sync_api::SyncManager::Status::OFFLINE_UNSYNCED;
- } else {
- status_.summary = sync_api::SyncManager::Status::OFFLINE;
+ } else if (status_.sync_count > 0) {
+ status_.summary = sync_api::SyncManager::Status::OFFLINE_UNUSABLE;
rlarocque 2012/02/02 22:44:13 Why? This would make the OFFLINE_UNSYNCED branch
lipalani1 2012/02/03 01:55:39 If you look at the comments for this enum OFFLINE
rlarocque 2012/02/03 18:55:03 OK, but this is still a big change to the definiti
}
rlarocque 2012/02/02 22:44:13 For completeness, I'd like to see an else branch t
lipalani1 2012/02/03 01:55:39 Done.
}

Powered by Google App Engine
This is Rietveld 408576698