Automated Commit: Committing new LKGM version 6953.0.0 for chromeos.
[chromium-blink-merge.git] / sync / sessions / status_controller.cc
blob4610a5150d05f41079f9df123b6ea8f1b99e1da4
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.
5 #include "sync/sessions/status_controller.h"
7 #include <vector>
9 #include "base/basictypes.h"
10 #include "sync/internal_api/public/base/model_type.h"
11 #include "sync/protocol/sync_protocol_error.h"
13 namespace syncer {
14 namespace sessions {
16 StatusController::StatusController() {
19 StatusController::~StatusController() {}
21 void StatusController::increment_num_updates_downloaded_by(int value) {
22 model_neutral_.num_updates_downloaded_total += value;
25 void StatusController::increment_num_tombstone_updates_downloaded_by(
26 int value) {
27 model_neutral_.num_tombstone_updates_downloaded_total += value;
30 void StatusController::increment_num_reflected_updates_downloaded_by(
31 int value) {
32 model_neutral_.num_reflected_updates_downloaded_total += value;
35 void StatusController::UpdateStartTime() {
36 sync_start_time_ = base::Time::Now();
39 void StatusController::set_num_successful_bookmark_commits(int value) {
40 model_neutral_.num_successful_bookmark_commits = value;
43 void StatusController::increment_num_successful_bookmark_commits() {
44 model_neutral_.num_successful_bookmark_commits++;
47 void StatusController::increment_num_successful_commits() {
48 model_neutral_.num_successful_commits++;
51 void StatusController::increment_num_updates_applied_by(int value) {
52 model_neutral_.num_updates_applied += value;
55 void StatusController::increment_num_encryption_conflicts_by(int value) {
56 model_neutral_.num_encryption_conflicts += value;
59 void StatusController::increment_num_hierarchy_conflicts_by(int value) {
60 model_neutral_.num_hierarchy_conflicts += value;
63 void StatusController::increment_num_server_conflicts() {
64 model_neutral_.num_server_conflicts++;
67 void StatusController::increment_num_local_overwrites() {
68 model_neutral_.num_local_overwrites++;
71 void StatusController::increment_num_server_overwrites() {
72 model_neutral_.num_server_overwrites++;
75 void StatusController::set_last_get_key_result(const SyncerError result) {
76 model_neutral_.last_get_key_result = result;
79 void StatusController::set_last_download_updates_result(
80 const SyncerError result) {
81 model_neutral_.last_download_updates_result = result;
84 void StatusController::set_commit_result(const SyncerError result) {
85 model_neutral_.commit_result = result;
88 SyncerError StatusController::last_get_key_result() const {
89 return model_neutral_.last_get_key_result;
92 int StatusController::num_updates_applied() const {
93 return model_neutral_.num_updates_applied;
96 int StatusController::num_server_overwrites() const {
97 return model_neutral_.num_server_overwrites;
100 int StatusController::num_encryption_conflicts() const {
101 return model_neutral_.num_encryption_conflicts;
104 int StatusController::num_hierarchy_conflicts() const {
105 return model_neutral_.num_hierarchy_conflicts;
108 int StatusController::num_server_conflicts() const {
109 return model_neutral_.num_server_conflicts;
112 int 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;
120 } // namespace sessions
121 } // namespace syncer