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

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

Issue 256413007: Remove changes remaining counter from about:sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « chrome/browser/sync/about_sync_util.cc ('k') | sync/engine/get_updates_processor.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/all_status.h" 5 #include "sync/engine/all_status.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/port.h" 10 #include "base/port.h"
(...skipping 14 matching lines...) Expand all
25 25
26 SyncStatus AllStatus::CreateBlankStatus() const { 26 SyncStatus AllStatus::CreateBlankStatus() const {
27 // Status is initialized with the previous status value. Variables 27 // Status is initialized with the previous status value. Variables
28 // whose values accumulate (e.g. lifetime counters like updates_received) 28 // whose values accumulate (e.g. lifetime counters like updates_received)
29 // are not to be cleared here. 29 // are not to be cleared here.
30 SyncStatus status = status_; 30 SyncStatus status = status_;
31 status.encryption_conflicts = 0; 31 status.encryption_conflicts = 0;
32 status.hierarchy_conflicts = 0; 32 status.hierarchy_conflicts = 0;
33 status.server_conflicts = 0; 33 status.server_conflicts = 0;
34 status.committed_count = 0; 34 status.committed_count = 0;
35 status.updates_available = 0;
36 return status; 35 return status;
37 } 36 }
38 37
39 SyncStatus AllStatus::CalcSyncing(const SyncCycleEvent &event) const { 38 SyncStatus AllStatus::CalcSyncing(const SyncCycleEvent &event) const {
40 SyncStatus status = CreateBlankStatus(); 39 SyncStatus status = CreateBlankStatus();
41 const sessions::SyncSessionSnapshot& snapshot = event.snapshot; 40 const sessions::SyncSessionSnapshot& snapshot = event.snapshot;
42 status.encryption_conflicts = snapshot.num_encryption_conflicts(); 41 status.encryption_conflicts = snapshot.num_encryption_conflicts();
43 status.hierarchy_conflicts = snapshot.num_hierarchy_conflicts(); 42 status.hierarchy_conflicts = snapshot.num_hierarchy_conflicts();
44 status.server_conflicts = snapshot.num_server_conflicts(); 43 status.server_conflicts = snapshot.num_server_conflicts();
45 status.committed_count = 44 status.committed_count =
46 snapshot.model_neutral_state().num_successful_commits; 45 snapshot.model_neutral_state().num_successful_commits;
47 46
48 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_BEGIN) { 47 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_BEGIN) {
49 status.syncing = true; 48 status.syncing = true;
50 } else if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) { 49 } else if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) {
51 status.syncing = false; 50 status.syncing = false;
52 } 51 }
53 52
54 status.updates_available += snapshot.num_server_changes_remaining();
55
56 status.num_entries_by_type = snapshot.num_entries_by_type(); 53 status.num_entries_by_type = snapshot.num_entries_by_type();
57 status.num_to_delete_entries_by_type = 54 status.num_to_delete_entries_by_type =
58 snapshot.num_to_delete_entries_by_type(); 55 snapshot.num_to_delete_entries_by_type();
59 56
60 // Accumulate update count only once per session to avoid double-counting. 57 // Accumulate update count only once per session to avoid double-counting.
61 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) { 58 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) {
62 status.updates_received += 59 status.updates_received +=
63 snapshot.model_neutral_state().num_updates_downloaded_total; 60 snapshot.model_neutral_state().num_updates_downloaded_total;
64 status.tombstone_updates_received += 61 status.tombstone_updates_received +=
65 snapshot.model_neutral_state().num_tombstone_updates_downloaded_total; 62 snapshot.model_neutral_state().num_tombstone_updates_downloaded_total;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus) 186 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus)
190 : allstatus_(allstatus) { 187 : allstatus_(allstatus) {
191 allstatus->mutex_.Acquire(); 188 allstatus->mutex_.Acquire();
192 } 189 }
193 190
194 ScopedStatusLock::~ScopedStatusLock() { 191 ScopedStatusLock::~ScopedStatusLock() {
195 allstatus_->mutex_.Release(); 192 allstatus_->mutex_.Release();
196 } 193 }
197 194
198 } // namespace syncer 195 } // namespace syncer
OLDNEW
« no previous file with comments | « chrome/browser/sync/about_sync_util.cc ('k') | sync/engine/get_updates_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698