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

Side by Side Diff: sync/engine/download.cc

Issue 93433006: sync: Introduce ModelTypeRegistry and helpers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leak in tests Created 6 years, 11 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/engine/download.h ('k') | sync/engine/download_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/engine/download.h" 5 #include "sync/engine/download.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "sync/engine/process_updates_util.h"
11 #include "sync/engine/sync_directory_update_handler.h"
12 #include "sync/engine/syncer.h" 10 #include "sync/engine/syncer.h"
13 #include "sync/engine/syncer_proto_util.h" 11 #include "sync/engine/syncer_proto_util.h"
14 #include "sync/sessions/nudge_tracker.h" 12 #include "sync/sessions/nudge_tracker.h"
15 #include "sync/syncable/directory.h" 13 #include "sync/syncable/directory.h"
16 #include "sync/syncable/nigori_handler.h" 14 #include "sync/syncable/nigori_handler.h"
17 #include "sync/syncable/syncable_read_transaction.h" 15 #include "sync/syncable/syncable_read_transaction.h"
18 16
19 namespace syncer { 17 namespace syncer {
20 18
21 using sessions::StatusController; 19 using sessions::StatusController;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 get_updates->set_create_mobile_bookmarks_folder( 95 get_updates->set_create_mobile_bookmarks_folder(
98 create_mobile_bookmarks_folder); 96 create_mobile_bookmarks_folder);
99 bool need_encryption_key = ShouldRequestEncryptionKey(session->context()); 97 bool need_encryption_key = ShouldRequestEncryptionKey(session->context());
100 get_updates->set_need_encryption_key(need_encryption_key); 98 get_updates->set_need_encryption_key(need_encryption_key);
101 99
102 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. 100 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information.
103 get_updates->mutable_caller_info()->set_notifications_enabled( 101 get_updates->mutable_caller_info()->set_notifications_enabled(
104 session->context()->notifications_enabled()); 102 session->context()->notifications_enabled());
105 } 103 }
106 104
107 void InitDownloadUpdatesProgress(
108 ModelTypeSet proto_request_types,
109 UpdateHandlerMap* handler_map,
110 sync_pb::GetUpdatesMessage* get_updates) {
111 for (ModelTypeSet::Iterator it = proto_request_types.First();
112 it.Good(); it.Inc()) {
113 UpdateHandlerMap::iterator handler_it = handler_map->find(it.Get());
114 DCHECK(handler_it != handler_map->end());
115 sync_pb::DataTypeProgressMarker* progress_marker =
116 get_updates->add_from_progress_marker();
117 handler_it->second->GetDownloadProgress(progress_marker);
118 }
119 }
120
121 // Builds a map of ModelTypes to indices to progress markers in the given
122 // |gu_response| message. The map is returned in the |index_map| parameter.
123 void PartitionProgressMarkersByType(
124 const sync_pb::GetUpdatesResponse& gu_response,
125 ModelTypeSet request_types,
126 TypeToIndexMap* index_map) {
127 for (int i = 0; i < gu_response.new_progress_marker_size(); ++i) {
128 int field_number = gu_response.new_progress_marker(i).data_type_id();
129 ModelType model_type = GetModelTypeFromSpecificsFieldNumber(field_number);
130 if (!IsRealDataType(model_type)) {
131 DLOG(WARNING) << "Unknown field number " << field_number;
132 continue;
133 }
134 if (!request_types.Has(model_type)) {
135 DLOG(WARNING)
136 << "Skipping unexpected progress marker for non-enabled type "
137 << ModelTypeToString(model_type);
138 continue;
139 }
140 index_map->insert(std::make_pair(model_type, i));
141 }
142 }
143
144 // Examines the contents of the GetUpdates response message and forwards
145 // relevant data to the UpdateHandlers for processing and persisting.
146 bool ProcessUpdateResponseContents(
147 const sync_pb::GetUpdatesResponse& gu_response,
148 ModelTypeSet proto_request_types,
149 UpdateHandlerMap* handler_map,
150 StatusController* status) {
151 TypeSyncEntityMap updates_by_type;
152 PartitionUpdatesByType(gu_response, proto_request_types, &updates_by_type);
153 DCHECK_EQ(proto_request_types.Size(), updates_by_type.size());
154
155 TypeToIndexMap progress_index_by_type;
156 PartitionProgressMarkersByType(gu_response,
157 proto_request_types,
158 &progress_index_by_type);
159 if (proto_request_types.Size() != progress_index_by_type.size()) {
160 NOTREACHED() << "Missing progress markers in GetUpdates response.";
161 return false;
162 }
163
164 // Iterate over these maps in parallel, processing updates for each type.
165 TypeToIndexMap::iterator progress_marker_iter =
166 progress_index_by_type.begin();
167 TypeSyncEntityMap::iterator updates_iter = updates_by_type.begin();
168 for ( ; (progress_marker_iter != progress_index_by_type.end()
169 && updates_iter != updates_by_type.end());
170 ++progress_marker_iter, ++updates_iter) {
171 DCHECK_EQ(progress_marker_iter->first, updates_iter->first);
172 ModelType type = progress_marker_iter->first;
173
174 UpdateHandlerMap::iterator update_handler_iter = handler_map->find(type);
175
176 if (update_handler_iter != handler_map->end()) {
177 update_handler_iter->second->ProcessGetUpdatesResponse(
178 gu_response.new_progress_marker(progress_marker_iter->second),
179 updates_iter->second,
180 status);
181 } else {
182 DLOG(WARNING)
183 << "Ignoring received updates of a type we can't handle. "
184 << "Type is: " << ModelTypeToString(type);
185 continue;
186 }
187 }
188 DCHECK(progress_marker_iter == progress_index_by_type.end()
189 && updates_iter == updates_by_type.end());
190
191 return true;
192 }
193
194 } // namespace 105 } // namespace
195 106
196 void BuildNormalDownloadUpdates( 107 void BuildNormalDownloadUpdates(
197 SyncSession* session, 108 SyncSession* session,
109 GetUpdatesProcessor* get_updates_processor,
198 bool create_mobile_bookmarks_folder, 110 bool create_mobile_bookmarks_folder,
199 ModelTypeSet request_types, 111 ModelTypeSet request_types,
200 const sessions::NudgeTracker& nudge_tracker, 112 const sessions::NudgeTracker& nudge_tracker,
201 sync_pb::ClientToServerMessage* client_to_server_message) { 113 sync_pb::ClientToServerMessage* client_to_server_message) {
202 // Request updates for all requested types. 114 // Request updates for all requested types.
203 DVLOG(1) << "Getting updates for types " 115 DVLOG(1) << "Getting updates for types "
204 << ModelTypeSetToString(request_types); 116 << ModelTypeSetToString(request_types);
205 DCHECK(!request_types.Empty()); 117 DCHECK(!request_types.Empty());
206 118
207 InitDownloadUpdatesContext( 119 InitDownloadUpdatesContext(
208 session, 120 session,
209 create_mobile_bookmarks_folder, 121 create_mobile_bookmarks_folder,
210 client_to_server_message); 122 client_to_server_message);
211 123
212 BuildNormalDownloadUpdatesImpl( 124 BuildNormalDownloadUpdatesImpl(
213 Intersection(request_types, ProtocolTypes()), 125 Intersection(request_types, ProtocolTypes()),
214 session->context()->update_handler_map(), 126 get_updates_processor,
215 nudge_tracker, 127 nudge_tracker,
216 client_to_server_message->mutable_get_updates()); 128 client_to_server_message->mutable_get_updates());
217 } 129 }
218 130
219 void BuildNormalDownloadUpdatesImpl( 131 void BuildNormalDownloadUpdatesImpl(
220 ModelTypeSet proto_request_types, 132 ModelTypeSet proto_request_types,
221 UpdateHandlerMap* update_handler_map, 133 GetUpdatesProcessor* get_updates_processor,
222 const sessions::NudgeTracker& nudge_tracker, 134 const sessions::NudgeTracker& nudge_tracker,
223 sync_pb::GetUpdatesMessage* get_updates) { 135 sync_pb::GetUpdatesMessage* get_updates) {
224 DCHECK(!proto_request_types.Empty()); 136 DCHECK(!proto_request_types.Empty());
225 137
226 InitDownloadUpdatesProgress( 138 // Get progress markers and other data for requested types.
227 proto_request_types, 139 get_updates_processor->PrepareGetUpdates(proto_request_types, get_updates);
228 update_handler_map,
229 get_updates);
230 140
231 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. 141 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information.
232 get_updates->mutable_caller_info()->set_source( 142 get_updates->mutable_caller_info()->set_source(
233 nudge_tracker.updates_source()); 143 nudge_tracker.updates_source());
234 144
235 // Set the new and improved version of source, too. 145 // Set the new and improved version of source, too.
236 get_updates->set_get_updates_origin(sync_pb::SyncEnums::GU_TRIGGER); 146 get_updates->set_get_updates_origin(sync_pb::SyncEnums::GU_TRIGGER);
237 get_updates->set_is_retry( 147 get_updates->set_is_retry(
238 nudge_tracker.IsRetryRequired(base::TimeTicks::Now())); 148 nudge_tracker.IsRetryRequired(base::TimeTicks::Now()));
239 149
240 // Fill in the notification hints. 150 // Fill in the notification hints.
241 for (int i = 0; i < get_updates->from_progress_marker_size(); ++i) { 151 for (int i = 0; i < get_updates->from_progress_marker_size(); ++i) {
242 sync_pb::DataTypeProgressMarker* progress_marker = 152 sync_pb::DataTypeProgressMarker* progress_marker =
243 get_updates->mutable_from_progress_marker(i); 153 get_updates->mutable_from_progress_marker(i);
244 ModelType type = GetModelTypeFromSpecificsFieldNumber( 154 ModelType type = GetModelTypeFromSpecificsFieldNumber(
245 progress_marker->data_type_id()); 155 progress_marker->data_type_id());
246 156
247 DCHECK(!nudge_tracker.IsTypeThrottled(type)) 157 DCHECK(!nudge_tracker.IsTypeThrottled(type))
248 << "Throttled types should have been removed from the request_types."; 158 << "Throttled types should have been removed from the request_types.";
249 159
250 nudge_tracker.SetLegacyNotificationHint(type, progress_marker); 160 nudge_tracker.SetLegacyNotificationHint(type, progress_marker);
251 nudge_tracker.FillProtoMessage( 161 nudge_tracker.FillProtoMessage(
252 type, 162 type,
253 progress_marker->mutable_get_update_triggers()); 163 progress_marker->mutable_get_update_triggers());
254 } 164 }
255 } 165 }
256 166
257 void BuildDownloadUpdatesForConfigure( 167 void BuildDownloadUpdatesForConfigure(
258 SyncSession* session, 168 SyncSession* session,
169 GetUpdatesProcessor* get_updates_processor,
259 bool create_mobile_bookmarks_folder, 170 bool create_mobile_bookmarks_folder,
260 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, 171 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
261 ModelTypeSet request_types, 172 ModelTypeSet request_types,
262 sync_pb::ClientToServerMessage* client_to_server_message) { 173 sync_pb::ClientToServerMessage* client_to_server_message) {
263 // Request updates for all enabled types. 174 // Request updates for all enabled types.
264 DVLOG(1) << "Initial download for types " 175 DVLOG(1) << "Initial download for types "
265 << ModelTypeSetToString(request_types); 176 << ModelTypeSetToString(request_types);
266 177
267 InitDownloadUpdatesContext( 178 InitDownloadUpdatesContext(
268 session, 179 session,
269 create_mobile_bookmarks_folder, 180 create_mobile_bookmarks_folder,
270 client_to_server_message); 181 client_to_server_message);
271 BuildDownloadUpdatesForConfigureImpl( 182 BuildDownloadUpdatesForConfigureImpl(
272 Intersection(request_types, ProtocolTypes()), 183 Intersection(request_types, ProtocolTypes()),
273 session->context()->update_handler_map(), 184 get_updates_processor,
274 source, 185 source,
275 client_to_server_message->mutable_get_updates()); 186 client_to_server_message->mutable_get_updates());
276 } 187 }
277 188
278 void BuildDownloadUpdatesForConfigureImpl( 189 void BuildDownloadUpdatesForConfigureImpl(
279 ModelTypeSet proto_request_types, 190 ModelTypeSet proto_request_types,
280 UpdateHandlerMap* update_handler_map, 191 GetUpdatesProcessor* get_updates_processor,
281 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, 192 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
282 sync_pb::GetUpdatesMessage* get_updates) { 193 sync_pb::GetUpdatesMessage* get_updates) {
283 DCHECK(!proto_request_types.Empty()); 194 DCHECK(!proto_request_types.Empty());
284 195
285 InitDownloadUpdatesProgress( 196 // Get progress markers and other data for requested types.
286 proto_request_types, 197 get_updates_processor->PrepareGetUpdates(proto_request_types, get_updates);
287 update_handler_map,
288 get_updates);
289 198
290 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. 199 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information.
291 get_updates->mutable_caller_info()->set_source(source); 200 get_updates->mutable_caller_info()->set_source(source);
292 201
293 // Set the new and improved version of source, too. 202 // Set the new and improved version of source, too.
294 sync_pb::SyncEnums::GetUpdatesOrigin origin = 203 sync_pb::SyncEnums::GetUpdatesOrigin origin =
295 ConvertConfigureSourceToOrigin(source); 204 ConvertConfigureSourceToOrigin(source);
296 get_updates->set_get_updates_origin(origin); 205 get_updates->set_get_updates_origin(origin);
297 } 206 }
298 207
299 void BuildDownloadUpdatesForPoll( 208 void BuildDownloadUpdatesForPoll(
300 SyncSession* session, 209 SyncSession* session,
210 GetUpdatesProcessor* get_updates_processor,
301 bool create_mobile_bookmarks_folder, 211 bool create_mobile_bookmarks_folder,
302 ModelTypeSet request_types, 212 ModelTypeSet request_types,
303 sync_pb::ClientToServerMessage* client_to_server_message) { 213 sync_pb::ClientToServerMessage* client_to_server_message) {
304 DVLOG(1) << "Polling for types " 214 DVLOG(1) << "Polling for types "
305 << ModelTypeSetToString(request_types); 215 << ModelTypeSetToString(request_types);
306 216
307 InitDownloadUpdatesContext( 217 InitDownloadUpdatesContext(
308 session, 218 session,
309 create_mobile_bookmarks_folder, 219 create_mobile_bookmarks_folder,
310 client_to_server_message); 220 client_to_server_message);
311 BuildDownloadUpdatesForPollImpl( 221 BuildDownloadUpdatesForPollImpl(
312 Intersection(request_types, ProtocolTypes()), 222 Intersection(request_types, ProtocolTypes()),
313 session->context()->update_handler_map(), 223 get_updates_processor,
314 client_to_server_message->mutable_get_updates()); 224 client_to_server_message->mutable_get_updates());
315 } 225 }
316 226
317 void BuildDownloadUpdatesForPollImpl( 227 void BuildDownloadUpdatesForPollImpl(
318 ModelTypeSet proto_request_types, 228 ModelTypeSet proto_request_types,
319 UpdateHandlerMap* update_handler_map, 229 GetUpdatesProcessor* get_updates_processor,
320 sync_pb::GetUpdatesMessage* get_updates) { 230 sync_pb::GetUpdatesMessage* get_updates) {
321 DCHECK(!proto_request_types.Empty()); 231 DCHECK(!proto_request_types.Empty());
322 232
323 InitDownloadUpdatesProgress( 233 // Get progress markers and other data for requested types.
324 proto_request_types, 234 get_updates_processor->PrepareGetUpdates(proto_request_types, get_updates);
325 update_handler_map,
326 get_updates);
327 235
328 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. 236 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information.
329 get_updates->mutable_caller_info()->set_source( 237 get_updates->mutable_caller_info()->set_source(
330 sync_pb::GetUpdatesCallerInfo::PERIODIC); 238 sync_pb::GetUpdatesCallerInfo::PERIODIC);
331 239
332 // Set the new and improved version of source, too. 240 // Set the new and improved version of source, too.
333 get_updates->set_get_updates_origin(sync_pb::SyncEnums::PERIODIC); 241 get_updates->set_get_updates_origin(sync_pb::SyncEnums::PERIODIC);
334 } 242 }
335 243
336 void BuildDownloadUpdatesForRetry( 244 void BuildDownloadUpdatesForRetry(
337 SyncSession* session, 245 SyncSession* session,
246 GetUpdatesProcessor* get_updates_processor,
338 bool create_mobile_bookmarks_folder, 247 bool create_mobile_bookmarks_folder,
339 ModelTypeSet request_types, 248 ModelTypeSet request_types,
340 sync_pb::ClientToServerMessage* client_to_server_message) { 249 sync_pb::ClientToServerMessage* client_to_server_message) {
341 DVLOG(1) << "Retrying for types " 250 DVLOG(1) << "Retrying for types "
342 << ModelTypeSetToString(request_types); 251 << ModelTypeSetToString(request_types);
343 252
344 InitDownloadUpdatesContext( 253 InitDownloadUpdatesContext(
345 session, 254 session,
346 create_mobile_bookmarks_folder, 255 create_mobile_bookmarks_folder,
347 client_to_server_message); 256 client_to_server_message);
348 BuildDownloadUpdatesForRetryImpl( 257 BuildDownloadUpdatesForRetryImpl(
349 Intersection(request_types, ProtocolTypes()), 258 Intersection(request_types, ProtocolTypes()),
350 session->context()->update_handler_map(), 259 get_updates_processor,
351 client_to_server_message->mutable_get_updates()); 260 client_to_server_message->mutable_get_updates());
352 } 261 }
353 262
354 void BuildDownloadUpdatesForRetryImpl( 263 void BuildDownloadUpdatesForRetryImpl(
355 ModelTypeSet proto_request_types, 264 ModelTypeSet proto_request_types,
356 UpdateHandlerMap* update_handler_map, 265 GetUpdatesProcessor* get_updates_processor,
357 sync_pb::GetUpdatesMessage* get_updates) { 266 sync_pb::GetUpdatesMessage* get_updates) {
358 DCHECK(!proto_request_types.Empty()); 267 DCHECK(!proto_request_types.Empty());
359 268
360 InitDownloadUpdatesProgress( 269 get_updates_processor->PrepareGetUpdates(proto_request_types, get_updates);
361 proto_request_types,
362 update_handler_map,
363 get_updates);
364 270
365 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information. 271 // Set legacy GetUpdatesMessage.GetUpdatesCallerInfo information.
366 get_updates->mutable_caller_info()->set_source( 272 get_updates->mutable_caller_info()->set_source(
367 sync_pb::GetUpdatesCallerInfo::RETRY); 273 sync_pb::GetUpdatesCallerInfo::RETRY);
368 274
369 // Set the new and improved version of source, too. 275 // Set the new and improved version of source, too.
370 get_updates->set_get_updates_origin(sync_pb::SyncEnums::RETRY); 276 get_updates->set_get_updates_origin(sync_pb::SyncEnums::RETRY);
371 get_updates->set_is_retry(true); 277 get_updates->set_is_retry(true);
372 } 278 }
373 279
374 SyncerError ExecuteDownloadUpdates( 280 SyncerError ExecuteDownloadUpdates(
375 ModelTypeSet request_types, 281 ModelTypeSet request_types,
376 SyncSession* session, 282 SyncSession* session,
283 GetUpdatesProcessor* get_updates_processor,
377 sync_pb::ClientToServerMessage* msg) { 284 sync_pb::ClientToServerMessage* msg) {
378 sync_pb::ClientToServerResponse update_response; 285 sync_pb::ClientToServerResponse update_response;
379 StatusController* status = session->mutable_status_controller(); 286 StatusController* status = session->mutable_status_controller();
380 bool need_encryption_key = ShouldRequestEncryptionKey(session->context()); 287 bool need_encryption_key = ShouldRequestEncryptionKey(session->context());
381 288
382 if (session->context()->debug_info_getter()) { 289 if (session->context()->debug_info_getter()) {
383 sync_pb::DebugInfo* debug_info = msg->mutable_debug_info(); 290 sync_pb::DebugInfo* debug_info = msg->mutable_debug_info();
384 CopyClientDebugInfo(session->context()->debug_info_getter(), debug_info); 291 CopyClientDebugInfo(session->context()->debug_info_getter(), debug_info);
385 } 292 }
386 293
(...skipping 27 matching lines...) Expand all
414 syncable::Directory* dir = session->context()->directory(); 321 syncable::Directory* dir = session->context()->directory();
415 status->set_last_get_key_result( 322 status->set_last_get_key_result(
416 HandleGetEncryptionKeyResponse(update_response, dir)); 323 HandleGetEncryptionKeyResponse(update_response, dir));
417 } 324 }
418 325
419 const ModelTypeSet proto_request_types = 326 const ModelTypeSet proto_request_types =
420 Intersection(request_types, ProtocolTypes()); 327 Intersection(request_types, ProtocolTypes());
421 328
422 return ProcessResponse(update_response.get_updates(), 329 return ProcessResponse(update_response.get_updates(),
423 proto_request_types, 330 proto_request_types,
424 session->context()->update_handler_map(), 331 get_updates_processor,
425 status); 332 status);
426 } 333 }
427 334
428 SyncerError ProcessResponse( 335 SyncerError ProcessResponse(
429 const sync_pb::GetUpdatesResponse& gu_response, 336 const sync_pb::GetUpdatesResponse& gu_response,
430 ModelTypeSet proto_request_types, 337 ModelTypeSet proto_request_types,
431 UpdateHandlerMap* handler_map, 338 GetUpdatesProcessor* get_updates_processor,
432 StatusController* status) { 339 StatusController* status) {
433 status->increment_num_updates_downloaded_by(gu_response.entries_size()); 340 status->increment_num_updates_downloaded_by(gu_response.entries_size());
434 341
435 // The changes remaining field is used to prevent the client from looping. If 342 // The changes remaining field is used to prevent the client from looping. If
436 // that field is being set incorrectly, we're in big trouble. 343 // that field is being set incorrectly, we're in big trouble.
437 if (!gu_response.has_changes_remaining()) { 344 if (!gu_response.has_changes_remaining()) {
438 return SERVER_RESPONSE_VALIDATION_FAILED; 345 return SERVER_RESPONSE_VALIDATION_FAILED;
439 } 346 }
440 status->set_num_server_changes_remaining(gu_response.changes_remaining()); 347 status->set_num_server_changes_remaining(gu_response.changes_remaining());
441 348
442 349
443 if (!ProcessUpdateResponseContents(gu_response, 350 if (!get_updates_processor->ProcessGetUpdatesResponse(proto_request_types,
444 proto_request_types, 351 gu_response,
445 handler_map, 352 status)) {
446 status)) {
447 return SERVER_RESPONSE_VALIDATION_FAILED; 353 return SERVER_RESPONSE_VALIDATION_FAILED;
448 } 354 }
449 355
450 if (gu_response.changes_remaining() == 0) { 356 if (gu_response.changes_remaining() == 0) {
451 return SYNCER_OK; 357 return SYNCER_OK;
452 } else { 358 } else {
453 return SERVER_MORE_TO_DOWNLOAD; 359 return SERVER_MORE_TO_DOWNLOAD;
454 } 360 }
455 } 361 }
456 362
457 void CopyClientDebugInfo( 363 void CopyClientDebugInfo(
458 sessions::DebugInfoGetter* debug_info_getter, 364 sessions::DebugInfoGetter* debug_info_getter,
459 sync_pb::DebugInfo* debug_info) { 365 sync_pb::DebugInfo* debug_info) {
460 DVLOG(1) << "Copying client debug info to send."; 366 DVLOG(1) << "Copying client debug info to send.";
461 debug_info_getter->GetDebugInfo(debug_info); 367 debug_info_getter->GetDebugInfo(debug_info);
462 } 368 }
463 369
464 } // namespace download 370 } // namespace download
465 371
466 } // namespace syncer 372 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/download.h ('k') | sync/engine/download_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698