| 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" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 void Syncer::RequestEarlyExit() { | 57 void Syncer::RequestEarlyExit() { |
| 58 base::AutoLock lock(early_exit_requested_lock_); | 58 base::AutoLock lock(early_exit_requested_lock_); |
| 59 early_exit_requested_ = true; | 59 early_exit_requested_ = true; |
| 60 } | 60 } |
| 61 | 61 |
| 62 bool Syncer::NormalSyncShare(ModelTypeSet request_types, | 62 bool Syncer::NormalSyncShare(ModelTypeSet request_types, |
| 63 const NudgeTracker& nudge_tracker, | 63 const NudgeTracker& nudge_tracker, |
| 64 SyncSession* session) { | 64 SyncSession* session) { |
| 65 HandleCycleBegin(session); | 65 HandleCycleBegin(session); |
| 66 VLOG(1) << "Downloading types " << ModelTypeSetToString(request_types); | 66 VLOG(1) << "Downloading types " << ModelTypeSetToString(request_types); |
| 67 if (!DownloadAndApplyUpdates( | 67 if (nudge_tracker.IsGetUpdatesRequired() || |
| 68 session, | 68 session->context()->ShouldFetchUpdatesBeforeCommit()) { |
| 69 base::Bind(&NormalDownloadUpdates, | 69 if (!DownloadAndApplyUpdates( |
| 70 session, | 70 session, |
| 71 kCreateMobileBookmarksFolder, | 71 base::Bind(&NormalDownloadUpdates, |
| 72 request_types, | 72 session, |
| 73 base::ConstRef(nudge_tracker)))) { | 73 kCreateMobileBookmarksFolder, |
| 74 return HandleCycleEnd(session); | 74 request_types, |
| 75 base::ConstRef(nudge_tracker)))) { |
| 76 return HandleCycleEnd(session); |
| 77 } |
| 75 } | 78 } |
| 76 | 79 |
| 77 VLOG(1) << "Committing from types " << ModelTypeSetToString(request_types); | 80 VLOG(1) << "Committing from types " << ModelTypeSetToString(request_types); |
| 78 SyncerError commit_result = BuildAndPostCommits(request_types, this, session); | 81 SyncerError commit_result = BuildAndPostCommits(request_types, this, session); |
| 79 session->mutable_status_controller()->set_commit_result(commit_result); | 82 session->mutable_status_controller()->set_commit_result(commit_result); |
| 80 | 83 |
| 81 return HandleCycleEnd(session); | 84 return HandleCycleEnd(session); |
| 82 } | 85 } |
| 83 | 86 |
| 84 bool Syncer::ConfigureSyncShare(ModelTypeSet request_types, | 87 bool Syncer::ConfigureSyncShare(ModelTypeSet request_types, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 bool Syncer::HandleCycleEnd(SyncSession* session) { | 152 bool Syncer::HandleCycleEnd(SyncSession* session) { |
| 150 if (!ExitRequested()) { | 153 if (!ExitRequested()) { |
| 151 session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_ENDED); | 154 session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_ENDED); |
| 152 return true; | 155 return true; |
| 153 } else { | 156 } else { |
| 154 return false; | 157 return false; |
| 155 } | 158 } |
| 156 } | 159 } |
| 157 | 160 |
| 158 } // namespace syncer | 161 } // namespace syncer |
| OLD | NEW |