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

Unified Diff: sync/internal_api/all_status.cc

Issue 10197004: [Sync] Convert SyncSessionSnapshot to a copy-able class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/internal_api/all_status.h ('k') | sync/internal_api/debug_info_event_listener.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/all_status.cc
diff --git a/sync/internal_api/all_status.cc b/sync/internal_api/all_status.cc
index 89fe414dd9ed59959e9a98be9af47d3159a92971..3cbfb8f713a43c121ffd62ae6d621b699642030c 100644
--- a/sync/internal_api/all_status.cc
+++ b/sync/internal_api/all_status.cc
@@ -44,13 +44,13 @@ sync_api::SyncManager::Status AllStatus::CreateBlankStatus() const {
sync_api::SyncManager::Status AllStatus::CalcSyncing(
const SyncEngineEvent &event) const {
sync_api::SyncManager::Status status = CreateBlankStatus();
- const sessions::SyncSessionSnapshot* snapshot = event.snapshot;
- status.unsynced_count = static_cast<int>(snapshot->unsynced_count);
- status.encryption_conflicts = snapshot->num_encryption_conflicts;
- status.hierarchy_conflicts = snapshot->num_hierarchy_conflicts;
- status.simple_conflicts = snapshot->num_simple_conflicts;
- status.server_conflicts = snapshot->num_server_conflicts;
- status.committed_count = snapshot->syncer_status.num_successful_commits;
+ const sessions::SyncSessionSnapshot& snapshot = event.snapshot;
+ status.unsynced_count = static_cast<int>(snapshot.unsynced_count());
+ status.encryption_conflicts = snapshot.num_encryption_conflicts();
+ status.hierarchy_conflicts = snapshot.num_hierarchy_conflicts();
+ status.simple_conflicts = snapshot.num_simple_conflicts();
+ status.server_conflicts = snapshot.num_server_conflicts();
+ status.committed_count = snapshot.syncer_status().num_successful_commits;
if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_BEGIN) {
status.syncing = true;
@@ -58,37 +58,37 @@ sync_api::SyncManager::Status AllStatus::CalcSyncing(
status.syncing = false;
}
- status.initial_sync_ended |= snapshot->is_share_usable;
+ status.initial_sync_ended |= snapshot.is_share_usable();
- status.updates_available += snapshot->num_server_changes_remaining;
- status.sync_protocol_error = snapshot->errors.sync_protocol_error;
+ status.updates_available += snapshot.num_server_changes_remaining();
+ status.sync_protocol_error = snapshot.errors().sync_protocol_error;
// Accumulate update count only once per session to avoid double-counting.
// 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.updates_received +=
- snapshot->syncer_status.num_updates_downloaded_total;
+ snapshot.syncer_status().num_updates_downloaded_total;
status.tombstone_updates_received +=
- snapshot->syncer_status.num_tombstone_updates_downloaded_total;
+ snapshot.syncer_status().num_tombstone_updates_downloaded_total;
status.reflected_updates_received +=
- snapshot->syncer_status.num_reflected_updates_downloaded_total;
+ snapshot.syncer_status().num_reflected_updates_downloaded_total;
status.num_local_overwrites_total +=
- snapshot->syncer_status.num_local_overwrites;
+ snapshot.syncer_status().num_local_overwrites;
status.num_server_overwrites_total +=
- snapshot->syncer_status.num_server_overwrites;
- if (snapshot->syncer_status.num_updates_downloaded_total == 0) {
+ snapshot.syncer_status().num_server_overwrites;
+ if (snapshot.syncer_status().num_updates_downloaded_total == 0) {
++status.empty_get_updates;
} else {
++status.nonempty_get_updates;
}
- if (snapshot->syncer_status.num_successful_commits == 0) {
+ if (snapshot.syncer_status().num_successful_commits == 0) {
++status.sync_cycles_without_commits;
} else {
++status.sync_cycles_with_commits;
}
- if (snapshot->syncer_status.num_successful_commits == 0 &&
- snapshot->syncer_status.num_updates_downloaded_total == 0) {
+ if (snapshot.syncer_status().num_successful_commits == 0 &&
+ snapshot.syncer_status().num_updates_downloaded_total == 0) {
++status.useless_sync_cycles;
} else {
++status.useful_sync_cycles;
@@ -112,7 +112,7 @@ void AllStatus::OnSyncEngineEvent(const SyncEngineEvent& event) {
break;
case SyncEngineEvent::ACTIONABLE_ERROR:
status_ = CreateBlankStatus();
- status_.sync_protocol_error = event.snapshot->errors.sync_protocol_error;
+ status_.sync_protocol_error = event.snapshot.errors().sync_protocol_error;
break;
default:
LOG(ERROR) << "Unrecognized Syncer Event: " << event.what_happened;
« no previous file with comments | « sync/internal_api/all_status.h ('k') | sync/internal_api/debug_info_event_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698