diff options
author | maxbogue <maxbogue@chromium.org> | 2016-02-25 13:43:04 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-25 21:44:48 +0000 |
commit | 385c8b25e46a5d8ceaa930badc4274c3b4167e96 (patch) | |
tree | 35ad787b3c4a7e53ca4e851fa4eeaa9e425a7304 /sync/engine | |
parent | 88e4b0b424242a1abb92f9c16bbca549eb016291 (diff) | |
download | chromium_src-385c8b25e46a5d8ceaa930badc4274c3b4167e96.zip chromium_src-385c8b25e46a5d8ceaa930badc4274c3b4167e96.tar.gz chromium_src-385c8b25e46a5d8ceaa930badc4274c3b4167e96.tar.bz2 |
[Sync] USS: Remove pending updates from SharedModelTypeProcessor.
We are planning to handle these in the worker in a future update.
BUG=529498
Review URL: https://codereview.chromium.org/1725573002
Cr-Commit-Position: refs/heads/master@{#377673}
Diffstat (limited to 'sync/engine')
-rw-r--r-- | sync/engine/model_type_worker.cc | 19 | ||||
-rw-r--r-- | sync/engine/model_type_worker.h | 1 | ||||
-rw-r--r-- | sync/engine/model_type_worker_unittest.cc | 22 |
3 files changed, 11 insertions, 31 deletions
diff --git a/sync/engine/model_type_worker.cc b/sync/engine/model_type_worker.cc index 1dfcf2d8..8f58de2 100644 --- a/sync/engine/model_type_worker.cc +++ b/sync/engine/model_type_worker.cc @@ -34,7 +34,6 @@ using syncer::SyncerError; ModelTypeWorker::ModelTypeWorker( ModelType type, const sync_pb::DataTypeState& initial_state, - const UpdateResponseDataList& saved_pending_updates, scoped_ptr<Cryptographer> cryptographer, NudgeHandler* nudge_handler, scoped_ptr<ModelTypeProcessor> model_type_processor) @@ -49,16 +48,6 @@ ModelTypeWorker::ModelTypeWorker( nudge_handler_->NudgeForInitialDownload(type_); } - for (UpdateResponseDataList::const_iterator it = - saved_pending_updates.begin(); - it != saved_pending_updates.end(); ++it) { - scoped_ptr<EntityTracker> entity_tracker = - EntityTracker::FromUpdateResponse(*it); - entity_tracker->ReceivePendingUpdate(*it); - entities_.insert( - std::make_pair(it->entity->client_tag_hash, std::move(entity_tracker))); - } - if (cryptographer_) { DVLOG(1) << ModelTypeToString(type_) << ": Starting with encryption key " << cryptographer_->GetDefaultNigoriKeyName(); @@ -194,8 +183,7 @@ SyncerError ModelTypeWorker::ProcessGetUpdatesResponse( response_datas.size(), pending_updates.size()); // Forward these updates to the model thread so it can do the rest. - model_type_processor_->OnUpdateReceived(data_type_state_, response_datas, - pending_updates); + model_type_processor_->OnUpdateReceived(data_type_state_, response_datas); return syncer::SYNCER_OK; } @@ -212,7 +200,7 @@ void ModelTypeWorker::ApplyUpdates(syncer::sessions::StatusController* status) { data_type_state_.set_initial_sync_done(true); model_type_processor_->OnUpdateReceived( - data_type_state_, UpdateResponseDataList(), UpdateResponseDataList()); + data_type_state_, UpdateResponseDataList()); } } @@ -443,8 +431,7 @@ void ModelTypeWorker::OnCryptographerUpdated() { << base::StringPrintf("Delivering encryption key and %" PRIuS " decrypted updates.", response_datas.size()); - model_type_processor_->OnUpdateReceived(data_type_state_, response_datas, - UpdateResponseDataList()); + model_type_processor_->OnUpdateReceived(data_type_state_, response_datas); } } diff --git a/sync/engine/model_type_worker.h b/sync/engine/model_type_worker.h index be0430f..61e4b6e 100644 --- a/sync/engine/model_type_worker.h +++ b/sync/engine/model_type_worker.h @@ -61,7 +61,6 @@ class SYNC_EXPORT ModelTypeWorker : public syncer::UpdateHandler, public: ModelTypeWorker(syncer::ModelType type, const sync_pb::DataTypeState& initial_state, - const UpdateResponseDataList& saved_pending_updates, scoped_ptr<syncer::Cryptographer> cryptographer, syncer::NudgeHandler* nudge_handler, scoped_ptr<ModelTypeProcessor> model_type_processor); diff --git a/sync/engine/model_type_worker_unittest.cc b/sync/engine/model_type_worker_unittest.cc index f630590..b0a7529 100644 --- a/sync/engine/model_type_worker_unittest.cc +++ b/sync/engine/model_type_worker_unittest.cc @@ -148,7 +148,6 @@ class ModelTypeWorkerTest : public ::testing::Test { // be updated until the response is actually processed by the model thread. size_t GetNumModelThreadUpdateResponses() const; UpdateResponseDataList GetNthModelThreadUpdateResponse(size_t n) const; - UpdateResponseDataList GetNthModelThreadPendingUpdates(size_t n) const; sync_pb::DataTypeState GetNthModelThreadUpdateState(size_t n) const; // Reads the latest update response datas on the model thread. @@ -284,7 +283,8 @@ void ModelTypeWorkerTest::InitializeWithState( cryptographer_copy.reset(new Cryptographer(*cryptographer_)); } - worker_.reset(new ModelTypeWorker(kModelType, state, initial_pending_updates, + // TODO(maxbogue): crbug.com/529498: Inject pending updates somehow. + worker_.reset(new ModelTypeWorker(kModelType, state, std::move(cryptographer_copy), &mock_nudge_handler_, std::move(proxy))); } @@ -509,12 +509,6 @@ UpdateResponseDataList ModelTypeWorkerTest::GetNthModelThreadUpdateResponse( return mock_type_processor_->GetNthUpdateResponse(n); } -UpdateResponseDataList ModelTypeWorkerTest::GetNthModelThreadPendingUpdates( - size_t n) const { - DCHECK_LT(n, GetNumModelThreadUpdateResponses()); - return mock_type_processor_->GetNthPendingUpdates(n); -} - sync_pb::DataTypeState ModelTypeWorkerTest::GetNthModelThreadUpdateState( size_t n) const { DCHECK_LT(n, GetNumModelThreadUpdateResponses()); @@ -975,8 +969,6 @@ TEST_F(ModelTypeWorkerTest, ReceiveUndecryptableEntries) { ASSERT_EQ(1U, GetNumModelThreadUpdateResponses()); UpdateResponseDataList updates_list = GetNthModelThreadUpdateResponse(0); EXPECT_EQ(0U, updates_list.size()); - UpdateResponseDataList pending_updates = GetNthModelThreadPendingUpdates(0); - EXPECT_EQ(1U, pending_updates.size()); // The update will be delivered as soon as decryption becomes possible. UpdateLocalCryptographer(); @@ -1006,8 +998,6 @@ TEST_F(ModelTypeWorkerTest, EncryptedUpdateOverridesPendingCommit) { ASSERT_EQ(1U, GetNumModelThreadUpdateResponses()); UpdateResponseDataList updates_list = GetNthModelThreadUpdateResponse(0); EXPECT_EQ(0U, updates_list.size()); - UpdateResponseDataList pending_updates = GetNthModelThreadPendingUpdates(0); - EXPECT_EQ(1U, pending_updates.size()); } // Test decryption of pending updates saved across a restart. @@ -1042,7 +1032,9 @@ TEST_F(ModelTypeWorkerTest, RestorePendingEntries) { UpdateLocalCryptographer(); // Verify the item gets decrypted and sent back to the model thread. - ASSERT_TRUE(HasUpdateResponseOnModelThread("tag1")); + // TODO(maxbogue): crbug.com/529498: Uncomment when pending updates are + // handled by the worker again. + //ASSERT_TRUE(HasUpdateResponseOnModelThread("tag1")); } // Test decryption of pending updates saved across a restart. This test @@ -1076,7 +1068,9 @@ TEST_F(ModelTypeWorkerTest, RestoreApplicableEntries) { InitializeWithPendingUpdates(saved_pending_updates); // Verify the item gets decrypted and sent back to the model thread. - ASSERT_TRUE(HasUpdateResponseOnModelThread("tag1")); + // TODO(maxbogue): crbug.com/529498: Uncomment when pending updates are + // handled by the worker again. + //ASSERT_TRUE(HasUpdateResponseOnModelThread("tag1")); } // Test that undecryptable updates provide sufficient reason to not commit. |