Remove linux_chromium_gn_dbg from the chromium CQ.
[chromium-blink-merge.git] / sync / sessions / status_controller.cc
blobacb7f733b03a017bfc884bda5ee9c23f2fc7035d
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::UpdatePollTime() {
40 poll_finish_time_ = base::Time::Now();
43 void StatusController::set_num_successful_bookmark_commits(int value) {
44 model_neutral_.num_successful_bookmark_commits = value;
47 void StatusController::increment_num_successful_bookmark_commits() {
48 model_neutral_.num_successful_bookmark_commits++;
51 void StatusController::increment_num_successful_commits() {
52 model_neutral_.num_successful_commits++;
55 void StatusController::increment_num_updates_applied_by(int value) {
56 model_neutral_.num_updates_applied += value;
59 void StatusController::increment_num_encryption_conflicts_by(int value) {
60 model_neutral_.num_encryption_conflicts += value;
63 void StatusController::increment_num_hierarchy_conflicts_by(int value) {
64 model_neutral_.num_hierarchy_conflicts += value;
67 void StatusController::increment_num_server_conflicts() {
68 model_neutral_.num_server_conflicts++;
71 void StatusController::increment_num_local_overwrites() {
72 model_neutral_.num_local_overwrites++;
75 void StatusController::increment_num_server_overwrites() {
76 model_neutral_.num_server_overwrites++;
79 void StatusController::set_last_get_key_result(const SyncerError result) {
80 model_neutral_.last_get_key_result = result;
83 void StatusController::set_last_download_updates_result(
84 const SyncerError result) {
85 model_neutral_.last_download_updates_result = result;
88 void StatusController::set_commit_result(const SyncerError result) {
89 model_neutral_.commit_result = result;
92 SyncerError StatusController::last_get_key_result() const {
93 return model_neutral_.last_get_key_result;
96 int StatusController::num_updates_applied() const {
97 return model_neutral_.num_updates_applied;
100 int StatusController::num_server_overwrites() const {
101 return model_neutral_.num_server_overwrites;
104 int StatusController::num_encryption_conflicts() const {
105 return model_neutral_.num_encryption_conflicts;
108 int StatusController::num_hierarchy_conflicts() const {
109 return model_neutral_.num_hierarchy_conflicts;
112 int StatusController::num_server_conflicts() const {
113 return model_neutral_.num_server_conflicts;
116 int StatusController::TotalNumConflictingItems() const {
117 int sum = 0;
118 sum += num_encryption_conflicts();
119 sum += num_hierarchy_conflicts();
120 sum += num_server_conflicts();
121 return sum;
124 } // namespace sessions
125 } // namespace syncer