| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 sync_api::SyncManager::Status AllStatus::CalcSyncing( | 46 sync_api::SyncManager::Status AllStatus::CalcSyncing( |
| 47 const SyncEngineEvent &event) const { | 47 const SyncEngineEvent &event) const { |
| 48 sync_api::SyncManager::Status status = CreateBlankStatus(); | 48 sync_api::SyncManager::Status status = CreateBlankStatus(); |
| 49 const sessions::SyncSessionSnapshot* snapshot = event.snapshot; | 49 const sessions::SyncSessionSnapshot* snapshot = event.snapshot; |
| 50 status.unsynced_count += static_cast<int>(snapshot->unsynced_count); | 50 status.unsynced_count += static_cast<int>(snapshot->unsynced_count); |
| 51 status.conflicting_count += snapshot->errors.num_conflicting_commits; | 51 status.conflicting_count += snapshot->errors.num_conflicting_commits; |
| 52 // The syncer may not be done yet, which could cause conflicting updates. | 52 // The syncer may not be done yet, which could cause conflicting updates. |
| 53 // But this is only used for status, so it is better to have visibility. | 53 // But this is only used for status, so it is better to have visibility. |
| 54 status.conflicting_count += snapshot->num_conflicting_updates; | 54 status.conflicting_count += snapshot->num_conflicting_updates; |
| 55 | 55 |
| 56 status.syncing |= snapshot->syncer_status.syncing; | 56 status.syncing |= snapshot->syncer_status.sync_in_progress; |
| 57 status.syncing = snapshot->has_more_to_sync && snapshot->is_silenced; | 57 status.syncing = |
| 58 snapshot->has_more_to_sync && snapshot->is_silenced; |
| 58 status.initial_sync_ended |= snapshot->is_share_usable; | 59 status.initial_sync_ended |= snapshot->is_share_usable; |
| 59 status.syncer_stuck |= snapshot->syncer_status.syncer_stuck; | 60 status.syncer_stuck |= snapshot->syncer_status.syncer_stuck; |
| 60 | 61 |
| 61 const sessions::ErrorCounters& errors(snapshot->errors); | 62 const sessions::ErrorCounters& errors(snapshot->errors); |
| 62 if (errors.consecutive_errors > status.max_consecutive_errors) | 63 if (errors.consecutive_errors > status.max_consecutive_errors) |
| 63 status.max_consecutive_errors = errors.consecutive_errors; | 64 status.max_consecutive_errors = errors.consecutive_errors; |
| 64 | 65 |
| 65 // 100 is an arbitrary limit. | 66 // 100 is an arbitrary limit. |
| 66 if (errors.consecutive_transient_error_commits > 100) | 67 if (errors.consecutive_transient_error_commits > 100) |
| 67 status.server_broken = true; | 68 status.server_broken = true; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 : allstatus_(allstatus) { | 186 : allstatus_(allstatus) { |
| 186 allstatus->mutex_.Acquire(); | 187 allstatus->mutex_.Acquire(); |
| 187 } | 188 } |
| 188 | 189 |
| 189 ScopedStatusLock::~ScopedStatusLock() { | 190 ScopedStatusLock::~ScopedStatusLock() { |
| 190 allstatus_->CalcStatusChanges(); | 191 allstatus_->CalcStatusChanges(); |
| 191 allstatus_->mutex_.Release(); | 192 allstatus_->mutex_.Release(); |
| 192 } | 193 } |
| 193 | 194 |
| 194 } // namespace browser_sync | 195 } // namespace browser_sync |
| OLD | NEW |