| 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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 TRACE_EVENT0("sync", "ApplyUpdates"); | 172 TRACE_EVENT0("sync", "ApplyUpdates"); |
| 173 | 173 |
| 174 ApplyControlDataUpdates(session->context()->directory()); | 174 ApplyControlDataUpdates(session->context()->directory()); |
| 175 | 175 |
| 176 get_updates_processor->ApplyUpdatesForAllTypes( | 176 get_updates_processor->ApplyUpdatesForAllTypes( |
| 177 session->mutable_status_controller()); | 177 session->mutable_status_controller()); |
| 178 | 178 |
| 179 session->context()->set_hierarchy_conflict_detected( | 179 session->context()->set_hierarchy_conflict_detected( |
| 180 session->status_controller().num_hierarchy_conflicts() > 0); | 180 session->status_controller().num_hierarchy_conflicts() > 0); |
| 181 | 181 |
| 182 session->SendEventNotification(SyncEngineEvent::STATUS_CHANGED); | 182 session->SendEventNotification(SyncCycleEvent::STATUS_CHANGED); |
| 183 } | 183 } |
| 184 | 184 |
| 185 bool Syncer::DownloadUpdates( | 185 bool Syncer::DownloadUpdates( |
| 186 ModelTypeSet request_types, | 186 ModelTypeSet request_types, |
| 187 SyncSession* session, | 187 SyncSession* session, |
| 188 GetUpdatesProcessor* get_updates_processor, | 188 GetUpdatesProcessor* get_updates_processor, |
| 189 base::Callback<void(sync_pb::ClientToServerMessage*)> build_fn) { | 189 base::Callback<void(sync_pb::ClientToServerMessage*)> build_fn) { |
| 190 SyncerError download_result = UNSET; | 190 SyncerError download_result = UNSET; |
| 191 do { | 191 do { |
| 192 TRACE_EVENT0("sync", "DownloadUpdates"); | 192 TRACE_EVENT0("sync", "DownloadUpdates"); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if (error != SYNCER_OK) { | 235 if (error != SYNCER_OK) { |
| 236 return error; | 236 return error; |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 return SYNCER_OK; | 240 return SYNCER_OK; |
| 241 } | 241 } |
| 242 | 242 |
| 243 void Syncer::HandleCycleBegin(SyncSession* session) { | 243 void Syncer::HandleCycleBegin(SyncSession* session) { |
| 244 session->mutable_status_controller()->UpdateStartTime(); | 244 session->mutable_status_controller()->UpdateStartTime(); |
| 245 session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_BEGIN); | 245 session->SendEventNotification(SyncCycleEvent::SYNC_CYCLE_BEGIN); |
| 246 } | 246 } |
| 247 | 247 |
| 248 bool Syncer::HandleCycleEnd( | 248 bool Syncer::HandleCycleEnd( |
| 249 SyncSession* session, | 249 SyncSession* session, |
| 250 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { | 250 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { |
| 251 if (!ExitRequested()) { | 251 if (!ExitRequested()) { |
| 252 session->SendSyncCycleEndEventNotification(source); | 252 session->SendSyncCycleEndEventNotification(source); |
| 253 return true; | 253 return true; |
| 254 } else { | 254 } else { |
| 255 return false; | 255 return false; |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace syncer | 259 } // namespace syncer |
| OLD | NEW |