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

Side by Side Diff: chrome/browser/sync/engine/syncer.cc

Issue 7281017: [Sync] Add RequestCleanupDisabledTypes() method to SyncManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replaced with TODOs Created 9 years, 4 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 | « chrome/browser/sync/engine/syncer.h ('k') | chrome/browser/sync/glue/data_type_manager_impl.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/syncer.h" 5 #include "chrome/browser/sync/engine/syncer.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/tracked.h" 9 #include "base/tracked.h"
10 #include "chrome/browser/sync/engine/apply_updates_command.h" 10 #include "chrome/browser/sync/engine/apply_updates_command.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 base::AutoLock lock(early_exit_requested_lock_); 65 base::AutoLock lock(early_exit_requested_lock_);
66 return early_exit_requested_; 66 return early_exit_requested_;
67 } 67 }
68 68
69 void Syncer::RequestEarlyExit() { 69 void Syncer::RequestEarlyExit() {
70 base::AutoLock lock(early_exit_requested_lock_); 70 base::AutoLock lock(early_exit_requested_lock_);
71 early_exit_requested_ = true; 71 early_exit_requested_ = true;
72 } 72 }
73 73
74 void Syncer::SyncShare(sessions::SyncSession* session, 74 void Syncer::SyncShare(sessions::SyncSession* session,
75 const SyncerStep first_step, 75 SyncerStep first_step,
76 const SyncerStep last_step) { 76 SyncerStep last_step) {
77 ScopedDirLookup dir(session->context()->directory_manager(), 77 {
78 session->context()->account_name()); 78 ScopedDirLookup dir(session->context()->directory_manager(),
79 // The directory must be good here. 79 session->context()->account_name());
80 CHECK(dir.good()); 80 // The directory must be good here.
81 CHECK(dir.good());
82 }
81 83
82 ScopedSessionContextConflictResolver scoped(session->context(), 84 ScopedSessionContextConflictResolver scoped(session->context(),
83 &resolver_); 85 &resolver_);
84 SyncerStep current_step = first_step; 86 SyncerStep current_step = first_step;
85 87
86 SyncerStep next_step = current_step; 88 SyncerStep next_step = current_step;
87 while (!ExitRequested()) { 89 while (!ExitRequested()) {
88 switch (current_step) { 90 switch (current_step) {
89 case SYNCER_BEGIN: 91 case SYNCER_BEGIN:
90 VLOG(1) << "Syncer Begin"; 92 VLOG(1) << "Syncer Begin";
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 next_step = APPLY_UPDATES; 148 next_step = APPLY_UPDATES;
147 } else { 149 } else {
148 next_step = DOWNLOAD_UPDATES; 150 next_step = DOWNLOAD_UPDATES;
149 } 151 }
150 break; 152 break;
151 } 153 }
152 case APPLY_UPDATES: { 154 case APPLY_UPDATES: {
153 VLOG(1) << "Applying Updates"; 155 VLOG(1) << "Applying Updates";
154 ApplyUpdatesCommand apply_updates; 156 ApplyUpdatesCommand apply_updates;
155 apply_updates.Execute(session); 157 apply_updates.Execute(session);
156 next_step = BUILD_COMMIT_REQUEST; 158 if (last_step == APPLY_UPDATES) {
159 // We're in configuration mode, but we still need to run the
160 // SYNCER_END step.
161 last_step = SYNCER_END;
162 next_step = SYNCER_END;
163 } else {
164 next_step = BUILD_COMMIT_REQUEST;
165 }
157 break; 166 break;
158 } 167 }
159 // These two steps are combined since they are executed within the same 168 // These two steps are combined since they are executed within the same
160 // write transaction. 169 // write transaction.
161 case BUILD_COMMIT_REQUEST: { 170 case BUILD_COMMIT_REQUEST: {
162 session->status_controller()->set_syncing(true); 171 session->status_controller()->set_syncing(true);
163 172
164 VLOG(1) << "Processing Commit Request"; 173 VLOG(1) << "Processing Commit Request";
165 ScopedDirLookup dir(session->context()->directory_manager(), 174 ScopedDirLookup dir(session->context()->directory_manager(),
166 session->context()->account_name()); 175 session->context()->account_name());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 break; 266 break;
258 } 267 }
259 case CLEAR_PRIVATE_DATA: { 268 case CLEAR_PRIVATE_DATA: {
260 VLOG(1) << "Clear Private Data"; 269 VLOG(1) << "Clear Private Data";
261 ClearDataCommand clear_data_command; 270 ClearDataCommand clear_data_command;
262 clear_data_command.Execute(session); 271 clear_data_command.Execute(session);
263 next_step = SYNCER_END; 272 next_step = SYNCER_END;
264 break; 273 break;
265 } 274 }
266 case SYNCER_END: { 275 case SYNCER_END: {
276 VLOG(1) << "Syncer End";
277 SyncerEndCommand syncer_end_command;
278 syncer_end_command.Execute(session);
279 next_step = SYNCER_END;
267 break; 280 break;
268 } 281 }
269 default: 282 default:
270 LOG(ERROR) << "Unknown command: " << current_step; 283 LOG(ERROR) << "Unknown command: " << current_step;
271 } 284 }
272 VLOG(2) << "last step: " << last_step << ", current step: " 285 VLOG(2) << "last step: " << last_step << ", current step: "
273 << current_step << ", next step: " 286 << current_step << ", next step: "
274 << next_step << ", snapshot: " 287 << next_step << ", snapshot: "
275 << session->TakeSnapshot().ToString(); 288 << session->TakeSnapshot().ToString();
276 if (last_step == current_step) 289 if (last_step == current_step)
277 break; 290 break;
278 current_step = next_step; 291 current_step = next_step;
279 } 292 }
280
281 VLOG(1) << "Syncer End";
282 VLOG(2) << "last step: " << last_step << ", current step: "
283 << current_step << ", next step: "
284 << next_step << ", snapshot: "
285 << session->TakeSnapshot().ToString();
286 SyncerEndCommand syncer_end_command;
287 syncer_end_command.Execute(session);
288 return;
289 } 293 }
290 294
291 void Syncer::ProcessClientCommand(sessions::SyncSession* session) { 295 void Syncer::ProcessClientCommand(sessions::SyncSession* session) {
292 const ClientToServerResponse& response = 296 const ClientToServerResponse& response =
293 session->status_controller()->updates_response(); 297 session->status_controller()->updates_response();
294 if (!response.has_client_command()) 298 if (!response.has_client_command())
295 return; 299 return;
296 const ClientCommand& command = response.client_command(); 300 const ClientCommand& command = response.client_command();
297 301
298 // The server limits the number of items a client can commit in one batch. 302 // The server limits the number of items a client can commit in one batch.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 entry->Put(SERVER_CTIME, 0); 334 entry->Put(SERVER_CTIME, 0);
331 entry->Put(SERVER_VERSION, 0); 335 entry->Put(SERVER_VERSION, 0);
332 entry->Put(SERVER_IS_DIR, false); 336 entry->Put(SERVER_IS_DIR, false);
333 entry->Put(SERVER_IS_DEL, false); 337 entry->Put(SERVER_IS_DEL, false);
334 entry->Put(IS_UNAPPLIED_UPDATE, false); 338 entry->Put(IS_UNAPPLIED_UPDATE, false);
335 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); 339 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance());
336 entry->Put(SERVER_POSITION_IN_PARENT, 0); 340 entry->Put(SERVER_POSITION_IN_PARENT, 0);
337 } 341 }
338 342
339 } // namespace browser_sync 343 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer.h ('k') | chrome/browser/sync/glue/data_type_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698