OLD | NEW |
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/engine/syncer.h" | 5 #include "sync/engine/syncer.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "sync/engine/apply_updates_command.h" | 13 #include "sync/engine/apply_updates_command.h" |
14 #include "sync/engine/build_commit_command.h" | 14 #include "sync/engine/build_commit_command.h" |
15 #include "sync/engine/cleanup_disabled_types_command.h" | 15 #include "sync/engine/cleanup_disabled_types_command.h" |
16 #include "sync/engine/commit.h" | 16 #include "sync/engine/commit.h" |
17 #include "sync/engine/conflict_resolver.h" | 17 #include "sync/engine/conflict_resolver.h" |
18 #include "sync/engine/download_updates_command.h" | 18 #include "sync/engine/download_updates_command.h" |
19 #include "sync/engine/net/server_connection_manager.h" | 19 #include "sync/engine/net/server_connection_manager.h" |
20 #include "sync/engine/process_commit_response_command.h" | 20 #include "sync/engine/process_commit_response_command.h" |
21 #include "sync/engine/process_updates_command.h" | 21 #include "sync/engine/process_updates_command.h" |
22 #include "sync/engine/resolve_conflicts_command.h" | 22 #include "sync/engine/resolve_conflicts_command.h" |
23 #include "sync/engine/store_timestamps_command.h" | 23 #include "sync/engine/store_timestamps_command.h" |
24 #include "sync/engine/syncer_types.h" | 24 #include "sync/engine/syncer_types.h" |
25 #include "sync/engine/syncproto.h" | |
26 #include "sync/engine/throttled_data_type_tracker.h" | 25 #include "sync/engine/throttled_data_type_tracker.h" |
27 #include "sync/engine/verify_updates_command.h" | 26 #include "sync/engine/verify_updates_command.h" |
28 #include "sync/syncable/mutable_entry.h" | 27 #include "sync/syncable/mutable_entry.h" |
29 #include "sync/syncable/syncable-inl.h" | 28 #include "sync/syncable/syncable-inl.h" |
30 | 29 |
31 using base::Time; | 30 using base::Time; |
32 using base::TimeDelta; | 31 using base::TimeDelta; |
33 using sync_pb::ClientCommand; | 32 using sync_pb::ClientCommand; |
34 | 33 |
35 namespace syncer { | 34 namespace syncer { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 << "snapshot: " << session->TakeSnapshot().ToString(); | 236 << "snapshot: " << session->TakeSnapshot().ToString(); |
238 if (last_step == current_step) { | 237 if (last_step == current_step) { |
239 session->SetFinished(); | 238 session->SetFinished(); |
240 break; | 239 break; |
241 } | 240 } |
242 current_step = next_step; | 241 current_step = next_step; |
243 } | 242 } |
244 } | 243 } |
245 | 244 |
246 void Syncer::ProcessClientCommand(sessions::SyncSession* session) { | 245 void Syncer::ProcessClientCommand(sessions::SyncSession* session) { |
247 const ClientToServerResponse& response = | 246 const sync_pb::ClientToServerResponse& response = |
248 session->status_controller().updates_response(); | 247 session->status_controller().updates_response(); |
249 if (!response.has_client_command()) | 248 if (!response.has_client_command()) |
250 return; | 249 return; |
251 const ClientCommand& command = response.client_command(); | 250 const ClientCommand& command = response.client_command(); |
252 | 251 |
253 // The server limits the number of items a client can commit in one batch. | 252 // The server limits the number of items a client can commit in one batch. |
254 if (command.has_max_commit_batch_size()) { | 253 if (command.has_max_commit_batch_size()) { |
255 session->context()->set_max_commit_batch_size( | 254 session->context()->set_max_commit_batch_size( |
256 command.max_commit_batch_size()); | 255 command.max_commit_batch_size()); |
257 } | 256 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 entry->Put(SERVER_CTIME, Time()); | 289 entry->Put(SERVER_CTIME, Time()); |
291 entry->Put(SERVER_VERSION, 0); | 290 entry->Put(SERVER_VERSION, 0); |
292 entry->Put(SERVER_IS_DIR, false); | 291 entry->Put(SERVER_IS_DIR, false); |
293 entry->Put(SERVER_IS_DEL, false); | 292 entry->Put(SERVER_IS_DEL, false); |
294 entry->Put(IS_UNAPPLIED_UPDATE, false); | 293 entry->Put(IS_UNAPPLIED_UPDATE, false); |
295 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 294 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
296 entry->Put(SERVER_POSITION_IN_PARENT, 0); | 295 entry->Put(SERVER_POSITION_IN_PARENT, 0); |
297 } | 296 } |
298 | 297 |
299 } // namespace syncer | 298 } // namespace syncer |
OLD | NEW |