| OLD | NEW |
| 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 "chrome/browser/sync/internal_api/all_status.h" | 5 #include "chrome/browser/sync/internal_api/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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 status.sync_protocol_error = snapshot->errors.sync_protocol_error; | 65 status.sync_protocol_error = snapshot->errors.sync_protocol_error; |
| 66 | 66 |
| 67 // Accumulate update count only once per session to avoid double-counting. | 67 // Accumulate update count only once per session to avoid double-counting. |
| 68 // TODO(ncarter): Make this realtime by having the syncer_status | 68 // TODO(ncarter): Make this realtime by having the syncer_status |
| 69 // counter preserve its value across sessions. http://crbug.com/26339 | 69 // counter preserve its value across sessions. http://crbug.com/26339 |
| 70 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) { | 70 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) { |
| 71 status.updates_received += | 71 status.updates_received += |
| 72 snapshot->syncer_status.num_updates_downloaded_total; | 72 snapshot->syncer_status.num_updates_downloaded_total; |
| 73 status.tombstone_updates_received += | 73 status.tombstone_updates_received += |
| 74 snapshot->syncer_status.num_tombstone_updates_downloaded_total; | 74 snapshot->syncer_status.num_tombstone_updates_downloaded_total; |
| 75 status.reflected_updates_received += |
| 76 snapshot->syncer_status.num_reflected_updates_downloaded_total; |
| 75 status.num_local_overwrites_total += | 77 status.num_local_overwrites_total += |
| 76 snapshot->syncer_status.num_local_overwrites; | 78 snapshot->syncer_status.num_local_overwrites; |
| 77 status.num_server_overwrites_total += | 79 status.num_server_overwrites_total += |
| 78 snapshot->syncer_status.num_server_overwrites; | 80 snapshot->syncer_status.num_server_overwrites; |
| 79 if (snapshot->syncer_status.num_updates_downloaded_total == 0) { | 81 if (snapshot->syncer_status.num_updates_downloaded_total == 0) { |
| 80 ++status.empty_get_updates; | 82 ++status.empty_get_updates; |
| 81 } else { | 83 } else { |
| 82 ++status.nonempty_get_updates; | 84 ++status.nonempty_get_updates; |
| 83 } | 85 } |
| 84 if (snapshot->syncer_status.num_successful_commits == 0) { | 86 if (snapshot->syncer_status.num_successful_commits == 0) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 : allstatus_(allstatus) { | 181 : allstatus_(allstatus) { |
| 180 allstatus->mutex_.Acquire(); | 182 allstatus->mutex_.Acquire(); |
| 181 } | 183 } |
| 182 | 184 |
| 183 ScopedStatusLock::~ScopedStatusLock() { | 185 ScopedStatusLock::~ScopedStatusLock() { |
| 184 allstatus_->CalcStatusChanges(); | 186 allstatus_->CalcStatusChanges(); |
| 185 allstatus_->mutex_.Release(); | 187 allstatus_->mutex_.Release(); |
| 186 } | 188 } |
| 187 | 189 |
| 188 } // namespace browser_sync | 190 } // namespace browser_sync |
| OLD | NEW |