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

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

Issue 10909160: sync: Process client commands on commit response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor formatting improvement Created 8 years, 3 months 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/sync_session.h ('k') | sync/test/engine/mock_connection_manager.h » ('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/sync_session.h" 5 #include "sync/sessions/sync_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 enabled_groups_ = ComputeEnabledGroups(routing_info_, workers_); 145 enabled_groups_ = ComputeEnabledGroups(routing_info_, workers_);
146 } 146 }
147 147
148 void SyncSession::PrepareForAnotherSyncCycle() { 148 void SyncSession::PrepareForAnotherSyncCycle() {
149 finished_ = false; 149 finished_ = false;
150 source_.updates_source = 150 source_.updates_source =
151 sync_pb::GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION; 151 sync_pb::GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION;
152 status_controller_.reset(new StatusController(routing_info_)); 152 status_controller_.reset(new StatusController(routing_info_));
153 } 153 }
154 154
155 void SyncSession::ProcessClientCommand(const sync_pb::ClientCommand& command) {
tim (not reviewing) 2012/09/11 20:08:55 We have a few "do on every request/response" actio
rlarocque 2012/09/11 20:28:55 Done, sort of. I moved the call to this function
156 if (command.has_max_commit_batch_size()) {
157 context()->set_max_commit_batch_size(command.max_commit_batch_size());
158 }
159 if (command.has_set_sync_long_poll_interval()) {
160 delegate()->OnReceivedLongPollIntervalUpdate(
161 base::TimeDelta::FromSeconds(command.set_sync_long_poll_interval()));
162 }
163 if (command.has_set_sync_poll_interval()) {
164 delegate()->OnReceivedShortPollIntervalUpdate(
165 base::TimeDelta::FromSeconds(command.set_sync_poll_interval()));
166 }
167 if (command.has_sessions_commit_delay_seconds()) {
168 delegate()->OnReceivedSessionsCommitDelay(
169 base::TimeDelta::FromSeconds(command.sessions_commit_delay_seconds()));
170 }
171 }
172
155 SyncSessionSnapshot SyncSession::TakeSnapshot() const { 173 SyncSessionSnapshot SyncSession::TakeSnapshot() const {
156 syncable::Directory* dir = context_->directory(); 174 syncable::Directory* dir = context_->directory();
157 175
158 bool is_share_useable = true; 176 bool is_share_useable = true;
159 ModelTypeSet initial_sync_ended; 177 ModelTypeSet initial_sync_ended;
160 ModelTypeStateMap download_progress_markers; 178 ModelTypeStateMap download_progress_markers;
161 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { 179 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
162 ModelType type(ModelTypeFromInt(i)); 180 ModelType type(ModelTypeFromInt(i));
163 if (routing_info_.count(type) != 0) { 181 if (routing_info_.count(type) != 0) {
164 if (dir->initial_sync_ended_for_type(type)) 182 if (dir->initial_sync_ended_for_type(type))
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // with the server. Therefore, we verify no errors and at least one SYNCER_OK. 285 // with the server. Therefore, we verify no errors and at least one SYNCER_OK.
268 return reached_server && !HadErrors(state); 286 return reached_server && !HadErrors(state);
269 } 287 }
270 288
271 void SyncSession::SetFinished() { 289 void SyncSession::SetFinished() {
272 finished_ = true; 290 finished_ = true;
273 } 291 }
274 292
275 } // namespace sessions 293 } // namespace sessions
276 } // namespace syncer 294 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/sync_session.h ('k') | sync/test/engine/mock_connection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698