Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: sync/sessions/status_controller.cc

Issue 72403003: sync: Per-type update application (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + fix typo Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/sessions/status_controller.h ('k') | sync/sessions/status_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "sync/sessions/status_controller.h" 5 #include "sync/sessions/status_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "sync/internal_api/public/base/model_type.h" 10 #include "sync/internal_api/public/base/model_type.h"
11 #include "sync/protocol/sync_protocol_error.h" 11 #include "sync/protocol/sync_protocol_error.h"
12 12
13 namespace syncer { 13 namespace syncer {
14 namespace sessions { 14 namespace sessions {
15 15
16 StatusController::StatusController() 16 StatusController::StatusController() {
17 : group_restriction_in_effect_(false),
18 group_restriction_(GROUP_PASSIVE) {
19 } 17 }
20 18
21 StatusController::~StatusController() {} 19 StatusController::~StatusController() {}
22 20
23 void StatusController::increment_num_updates_downloaded_by(int value) { 21 void StatusController::increment_num_updates_downloaded_by(int value) {
24 model_neutral_.num_updates_downloaded_total += value; 22 model_neutral_.num_updates_downloaded_total += value;
25 } 23 }
26 24
27 void StatusController::set_types_needing_local_migration(ModelTypeSet types) { 25 void StatusController::set_types_needing_local_migration(ModelTypeSet types) {
28 model_neutral_.types_needing_local_migration = types; 26 model_neutral_.types_needing_local_migration = types;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 120
123 int StatusController::num_server_overwrites() const { 121 int StatusController::num_server_overwrites() const {
124 return model_neutral_.num_server_overwrites; 122 return model_neutral_.num_server_overwrites;
125 } 123 }
126 124
127 int StatusController::num_encryption_conflicts() const { 125 int StatusController::num_encryption_conflicts() const {
128 return model_neutral_.num_encryption_conflicts; 126 return model_neutral_.num_encryption_conflicts;
129 } 127 }
130 128
131 int StatusController::num_hierarchy_conflicts() const { 129 int StatusController::num_hierarchy_conflicts() const {
132 DCHECK(!group_restriction_in_effect_)
133 << "num_hierarchy_conflicts applies to all ModelSafeGroups";
134 return model_neutral_.num_hierarchy_conflicts; 130 return model_neutral_.num_hierarchy_conflicts;
135 } 131 }
136 132
137 int StatusController::num_server_conflicts() const { 133 int StatusController::num_server_conflicts() const {
138 DCHECK(!group_restriction_in_effect_)
139 << "num_server_conflicts applies to all ModelSafeGroups";
140 return model_neutral_.num_server_conflicts; 134 return model_neutral_.num_server_conflicts;
141 } 135 }
142 136
143 int StatusController::TotalNumConflictingItems() const { 137 int StatusController::TotalNumConflictingItems() const {
144 DCHECK(!group_restriction_in_effect_)
145 << "TotalNumConflictingItems applies to all ModelSafeGroups";
146 int sum = 0; 138 int sum = 0;
147 sum += num_encryption_conflicts(); 139 sum += num_encryption_conflicts();
148 sum += num_hierarchy_conflicts(); 140 sum += num_hierarchy_conflicts();
149 sum += num_server_conflicts(); 141 sum += num_server_conflicts();
150 return sum; 142 return sum;
151 } 143 }
152 144
153 bool StatusController::ServerSaysNothingMoreToDownload() const { 145 bool StatusController::ServerSaysNothingMoreToDownload() const {
154 if (!download_updates_succeeded()) 146 if (!download_updates_succeeded())
155 return false; 147 return false;
156 148
157 if (!updates_response().get_updates().has_changes_remaining()) { 149 if (!updates_response().get_updates().has_changes_remaining()) {
158 NOTREACHED(); // Server should always send changes remaining. 150 NOTREACHED(); // Server should always send changes remaining.
159 return false; // Avoid looping forever. 151 return false; // Avoid looping forever.
160 } 152 }
161 // Changes remaining is an estimate, but if it's estimated to be 153 // Changes remaining is an estimate, but if it's estimated to be
162 // zero, that's firm and we don't have to ask again. 154 // zero, that's firm and we don't have to ask again.
163 return updates_response().get_updates().changes_remaining() == 0; 155 return updates_response().get_updates().changes_remaining() == 0;
164 } 156 }
165 157
166 } // namespace sessions 158 } // namespace sessions
167 } // namespace syncer 159 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/status_controller.h ('k') | sync/sessions/status_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698