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 3 // found in the LICENSE file. 4 5 #include "sync/sessions/status_controller.h" 6 7 #include <vector> 8 9 #include "base/basictypes.h" 10 #include "sync/internal_api/public/base/model_type.h" 11 #include "sync/protocol/sync_protocol_error.h" 12 13 namespace syncer { 14 namespace sessions { 15 StatusController()16StatusController::StatusController() { 17 } 18 ~StatusController()19StatusController::~StatusController() {} 20 increment_num_updates_downloaded_by(int value)21void StatusController::increment_num_updates_downloaded_by(int value) { 22 model_neutral_.num_updates_downloaded_total += value; 23 } 24 increment_num_tombstone_updates_downloaded_by(int value)25void StatusController::increment_num_tombstone_updates_downloaded_by( 26 int value) { 27 model_neutral_.num_tombstone_updates_downloaded_total += value; 28 } 29 increment_num_reflected_updates_downloaded_by(int value)30void StatusController::increment_num_reflected_updates_downloaded_by( 31 int value) { 32 model_neutral_.num_reflected_updates_downloaded_total += value; 33 } 34 UpdateStartTime()35void StatusController::UpdateStartTime() { 36 sync_start_time_ = base::Time::Now(); 37 } 38 set_num_successful_bookmark_commits(int value)39void StatusController::set_num_successful_bookmark_commits(int value) { 40 model_neutral_.num_successful_bookmark_commits = value; 41 } 42 increment_num_successful_bookmark_commits()43void StatusController::increment_num_successful_bookmark_commits() { 44 model_neutral_.num_successful_bookmark_commits++; 45 } 46 increment_num_successful_commits()47void StatusController::increment_num_successful_commits() { 48 model_neutral_.num_successful_commits++; 49 } 50 increment_num_updates_applied_by(int value)51void StatusController::increment_num_updates_applied_by(int value) { 52 model_neutral_.num_updates_applied += value; 53 } 54 increment_num_encryption_conflicts_by(int value)55void StatusController::increment_num_encryption_conflicts_by(int value) { 56 model_neutral_.num_encryption_conflicts += value; 57 } 58 increment_num_hierarchy_conflicts_by(int value)59void StatusController::increment_num_hierarchy_conflicts_by(int value) { 60 model_neutral_.num_hierarchy_conflicts += value; 61 } 62 increment_num_server_conflicts()63void StatusController::increment_num_server_conflicts() { 64 model_neutral_.num_server_conflicts++; 65 } 66 increment_num_local_overwrites()67void StatusController::increment_num_local_overwrites() { 68 model_neutral_.num_local_overwrites++; 69 } 70 increment_num_server_overwrites()71void StatusController::increment_num_server_overwrites() { 72 model_neutral_.num_server_overwrites++; 73 } 74 set_last_get_key_result(const SyncerError result)75void StatusController::set_last_get_key_result(const SyncerError result) { 76 model_neutral_.last_get_key_result = result; 77 } 78 set_last_download_updates_result(const SyncerError result)79void StatusController::set_last_download_updates_result( 80 const SyncerError result) { 81 model_neutral_.last_download_updates_result = result; 82 } 83 set_commit_result(const SyncerError result)84void StatusController::set_commit_result(const SyncerError result) { 85 model_neutral_.commit_result = result; 86 } 87 last_get_key_result() const88SyncerError StatusController::last_get_key_result() const { 89 return model_neutral_.last_get_key_result; 90 } 91 num_updates_applied() const92int StatusController::num_updates_applied() const { 93 return model_neutral_.num_updates_applied; 94 } 95 num_server_overwrites() const96int StatusController::num_server_overwrites() const { 97 return model_neutral_.num_server_overwrites; 98 } 99 num_encryption_conflicts() const100int StatusController::num_encryption_conflicts() const { 101 return model_neutral_.num_encryption_conflicts; 102 } 103 num_hierarchy_conflicts() const104int StatusController::num_hierarchy_conflicts() const { 105 return model_neutral_.num_hierarchy_conflicts; 106 } 107 num_server_conflicts() const108int StatusController::num_server_conflicts() const { 109 return model_neutral_.num_server_conflicts; 110 } 111 TotalNumConflictingItems() const112int StatusController::TotalNumConflictingItems() const { 113 int sum = 0; 114 sum += num_encryption_conflicts(); 115 sum += num_hierarchy_conflicts(); 116 sum += num_server_conflicts(); 117 return sum; 118 } 119 120 } // namespace sessions 121 } // namespace syncer 122