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/auto_reset.h" | 7 #include "base/auto_reset.h" |
Nicolas Zea
2016/04/07 21:48:58
include memory?
| |
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" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "sync/engine/apply_control_data_updates.h" | 14 #include "sync/engine/apply_control_data_updates.h" |
15 #include "sync/engine/clear_server_data.h" | 15 #include "sync/engine/clear_server_data.h" |
16 #include "sync/engine/commit.h" | 16 #include "sync/engine/commit.h" |
17 #include "sync/engine/commit_processor.h" | 17 #include "sync/engine/commit_processor.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 } | 170 } |
171 | 171 |
172 SyncerError Syncer::BuildAndPostCommits(ModelTypeSet requested_types, | 172 SyncerError Syncer::BuildAndPostCommits(ModelTypeSet requested_types, |
173 sessions::NudgeTracker* nudge_tracker, | 173 sessions::NudgeTracker* nudge_tracker, |
174 sessions::SyncSession* session, | 174 sessions::SyncSession* session, |
175 CommitProcessor* commit_processor) { | 175 CommitProcessor* commit_processor) { |
176 // The ExitRequested() check is unnecessary, since we should start getting | 176 // The ExitRequested() check is unnecessary, since we should start getting |
177 // errors from the ServerConnectionManager if an exist has been requested. | 177 // errors from the ServerConnectionManager if an exist has been requested. |
178 // However, it doesn't hurt to check it anyway. | 178 // However, it doesn't hurt to check it anyway. |
179 while (!ExitRequested()) { | 179 while (!ExitRequested()) { |
180 scoped_ptr<Commit> commit( | 180 std::unique_ptr<Commit> commit(Commit::Init( |
181 Commit::Init( | 181 requested_types, session->context()->GetEnabledTypes(), |
182 requested_types, | 182 session->context()->max_commit_batch_size(), |
183 session->context()->GetEnabledTypes(), | 183 session->context()->account_name(), |
184 session->context()->max_commit_batch_size(), | 184 session->context()->directory()->cache_guid(), |
185 session->context()->account_name(), | 185 session->context()->cookie_jar_mismatch(), commit_processor, |
186 session->context()->directory()->cache_guid(), | 186 session->context()->extensions_activity())); |
187 session->context()->cookie_jar_mismatch(), | |
188 commit_processor, | |
189 session->context()->extensions_activity())); | |
190 if (!commit) { | 187 if (!commit) { |
191 break; | 188 break; |
192 } | 189 } |
193 | 190 |
194 SyncerError error = commit->PostAndProcessResponse( | 191 SyncerError error = commit->PostAndProcessResponse( |
195 nudge_tracker, session, session->mutable_status_controller(), | 192 nudge_tracker, session, session->mutable_status_controller(), |
196 session->context()->extensions_activity()); | 193 session->context()->extensions_activity()); |
197 commit->CleanUp(); | 194 commit->CleanUp(); |
198 if (error != SYNCER_OK) { | 195 if (error != SYNCER_OK) { |
199 return error; | 196 return error; |
(...skipping 25 matching lines...) Expand all Loading... | |
225 } | 222 } |
226 | 223 |
227 bool Syncer::PostClearServerData(SyncSession* session) { | 224 bool Syncer::PostClearServerData(SyncSession* session) { |
228 DCHECK(session); | 225 DCHECK(session); |
229 ClearServerData clear_server_data(session->context()->account_name()); | 226 ClearServerData clear_server_data(session->context()->account_name()); |
230 const SyncerError post_result = clear_server_data.SendRequest(session); | 227 const SyncerError post_result = clear_server_data.SendRequest(session); |
231 return post_result == SYNCER_OK; | 228 return post_result == SYNCER_OK; |
232 } | 229 } |
233 | 230 |
234 } // namespace syncer | 231 } // namespace syncer |
OLD | NEW |