diff options
| author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 19:07:36 +0000 |
|---|---|---|
| committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 19:07:36 +0000 |
| commit | 1ce52aae084f6a0201c64141e35772fc70bab1f0 (patch) | |
| tree | f1d3ee1f356df34f5746f4659c05b0de5438a808 /chrome/browser/sync/engine/syncer.cc | |
| parent | af3711395a43fc47aa5882148edc93d9674dcdf1 (diff) | |
| download | chromium_src-1ce52aae084f6a0201c64141e35772fc70bab1f0.zip chromium_src-1ce52aae084f6a0201c64141e35772fc70bab1f0.tar.gz chromium_src-1ce52aae084f6a0201c64141e35772fc70bab1f0.tar.bz2 | |
Implements the backend for clearing data from the server
BUG=54280
TEST=accessible only via unit test checked in this CL
Original patch by raz@chromium.org
Original review: http://codereview.chromium.org/3293007
Review URL: http://codereview.chromium.org/3310018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58859 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/engine/syncer.cc')
| -rw-r--r-- | chrome/browser/sync/engine/syncer.cc | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/chrome/browser/sync/engine/syncer.cc b/chrome/browser/sync/engine/syncer.cc index daf3bf0..112f474 100644 --- a/chrome/browser/sync/engine/syncer.cc +++ b/chrome/browser/sync/engine/syncer.cc @@ -11,6 +11,7 @@ #include "chrome/browser/sync/engine/build_and_process_conflict_sets_command.h" #include "chrome/browser/sync/engine/build_commit_command.h" #include "chrome/browser/sync/engine/cleanup_disabled_types_command.h" +#include "chrome/browser/sync/engine/clear_data_command.h" #include "chrome/browser/sync/engine/conflict_resolver.h" #include "chrome/browser/sync/engine/download_updates_command.h" #include "chrome/browser/sync/engine/get_commit_ids_command.h" @@ -96,20 +97,27 @@ bool Syncer::SyncShare(sessions::SyncSession::Delegate* delegate) { } bool Syncer::SyncShare(sessions::SyncSession* session) { - session->set_source(TestAndSetUpdatesSource()); - // This isn't perfect, as we can end up bundling extensions activity - // intended for the next session into the current one. We could do a - // test-and-reset as with the source, but note that also falls short if - // the commit request fails (due to lost connection, for example), as we will - // fall all the way back to the syncer thread main loop in that case, and - // wind up creating a new session when a connection is established, losing - // the records set here on the original attempt. This should provide us - // with the right data "most of the time", and we're only using this for - // analysis purposes, so Law of Large Numbers FTW. - context_->extensions_monitor()->GetAndClearRecords( - session->mutable_extensions_activity()); - SyncShare(session, SYNCER_BEGIN, SYNCER_END); - return session->HasMoreToSync(); + sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source = + TestAndSetUpdatesSource(); + session->set_source(source); + if (sync_pb::GetUpdatesCallerInfo::CLEAR_PRIVATE_DATA == source) { + SyncShare(session, CLEAR_PRIVATE_DATA, SYNCER_END); + return false; + } else { + // This isn't perfect, as we can end up bundling extensions activity + // intended for the next session into the current one. We could do a + // test-and-reset as with the source, but note that also falls short if + // the commit request fails (e.g. due to lost connection), as we will + // fall all the way back to the syncer thread main loop in that case, and + // wind up creating a new session when a connection is established, losing + // the records set here on the original attempt. This should provide us + // with the right data "most of the time", and we're only using this for + // analysis purposes, so Law of Large Numbers FTW. + context_->extensions_monitor()->GetAndClearRecords( + session->mutable_extensions_activity()); + SyncShare(session, SYNCER_BEGIN, SYNCER_END); + return session->HasMoreToSync(); + } } bool Syncer::SyncShare(SyncerStep first_step, SyncerStep last_step, @@ -276,6 +284,12 @@ void Syncer::SyncShare(sessions::SyncSession* session, next_step = SYNCER_END; break; } + case CLEAR_PRIVATE_DATA: { + LOG(INFO) << "Clear Private Data"; + ClearDataCommand clear_data_command; + clear_data_command.Execute(session); + next_step = SYNCER_END; + } case SYNCER_END: { LOG(INFO) << "Syncer End"; SyncerEndCommand syncer_end_command; |
