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

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

Issue 7013040: Add information about sync session and other useful data to about:sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload before commit. Created 9 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/backend_migrator_unittest.cc ('k') | chrome/browser/sync/engine/syncapi.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/engine/all_status.h" 5 #include "chrome/browser/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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // counter preserve its value across sessions. http://crbug.com/26339 72 // counter preserve its value across sessions. http://crbug.com/26339
73 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) { 73 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) {
74 status.updates_received += 74 status.updates_received +=
75 snapshot->syncer_status.num_updates_downloaded_total; 75 snapshot->syncer_status.num_updates_downloaded_total;
76 status.tombstone_updates_received += 76 status.tombstone_updates_received +=
77 snapshot->syncer_status.num_tombstone_updates_downloaded_total; 77 snapshot->syncer_status.num_tombstone_updates_downloaded_total;
78 status.num_local_overwrites_total += 78 status.num_local_overwrites_total +=
79 snapshot->syncer_status.num_local_overwrites; 79 snapshot->syncer_status.num_local_overwrites;
80 status.num_server_overwrites_total += 80 status.num_server_overwrites_total +=
81 snapshot->syncer_status.num_server_overwrites; 81 snapshot->syncer_status.num_server_overwrites;
82 if (snapshot->syncer_status.num_updates_downloaded_total == 0) {
83 ++status.empty_get_updates;
84 } else {
85 ++status.nonempty_get_updates;
86 }
87 if (snapshot->syncer_status.num_successful_commits == 0 &&
88 snapshot->syncer_status.num_updates_downloaded_total == 0) {
89 ++status.useless_sync_cycles;
90 } else {
91 ++status.useful_sync_cycles;
92 }
82 } 93 }
83 return status; 94 return status;
84 } 95 }
85 96
86 void AllStatus::CalcStatusChanges() { 97 void AllStatus::CalcStatusChanges() {
87 const bool unsynced_changes = status_.unsynced_count > 0; 98 const bool unsynced_changes = status_.unsynced_count > 0;
88 const bool online = status_.authenticated && 99 const bool online = status_.authenticated &&
89 status_.server_reachable && status_.server_up && !status_.server_broken; 100 status_.server_reachable && status_.server_up && !status_.server_broken;
90 if (online) { 101 if (online) {
91 if (status_.syncer_stuck) 102 if (status_.syncer_stuck)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 : allstatus_(allstatus) { 169 : allstatus_(allstatus) {
159 allstatus->mutex_.Acquire(); 170 allstatus->mutex_.Acquire();
160 } 171 }
161 172
162 ScopedStatusLock::~ScopedStatusLock() { 173 ScopedStatusLock::~ScopedStatusLock() {
163 allstatus_->CalcStatusChanges(); 174 allstatus_->CalcStatusChanges();
164 allstatus_->mutex_.Release(); 175 allstatus_->mutex_.Release();
165 } 176 }
166 177
167 } // namespace browser_sync 178 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/backend_migrator_unittest.cc ('k') | chrome/browser/sync/engine/syncapi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698