Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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_successful_commits == 0 && | |
| 83 snapshot->syncer_status.num_updates_downloaded_total == 0) { | |
| 84 ++status.empty_get_updates; | |
|
akalin
2011/05/16 22:34:58
rename to "useless_sync_cycles"
| |
| 85 } else { | |
| 86 ++status.nonempty_get_updates; | |
|
akalin
2011/05/16 22:34:58
rename to "useful_sync_cycles"
| |
| 87 } | |
| 82 } | 88 } |
| 83 return status; | 89 return status; |
| 84 } | 90 } |
| 85 | 91 |
| 86 void AllStatus::CalcStatusChanges() { | 92 void AllStatus::CalcStatusChanges() { |
| 87 const bool unsynced_changes = status_.unsynced_count > 0; | 93 const bool unsynced_changes = status_.unsynced_count > 0; |
| 88 const bool online = status_.authenticated && | 94 const bool online = status_.authenticated && |
| 89 status_.server_reachable && status_.server_up && !status_.server_broken; | 95 status_.server_reachable && status_.server_up && !status_.server_broken; |
| 90 if (online) { | 96 if (online) { |
| 91 if (status_.syncer_stuck) | 97 if (status_.syncer_stuck) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 : allstatus_(allstatus) { | 164 : allstatus_(allstatus) { |
| 159 allstatus->mutex_.Acquire(); | 165 allstatus->mutex_.Acquire(); |
| 160 } | 166 } |
| 161 | 167 |
| 162 ScopedStatusLock::~ScopedStatusLock() { | 168 ScopedStatusLock::~ScopedStatusLock() { |
| 163 allstatus_->CalcStatusChanges(); | 169 allstatus_->CalcStatusChanges(); |
| 164 allstatus_->mutex_.Release(); | 170 allstatus_->mutex_.Release(); |
| 165 } | 171 } |
| 166 | 172 |
| 167 } // namespace browser_sync | 173 } // namespace browser_sync |
| OLD | NEW |