Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/sync/user_events/user_event_sync_bridge.h" | 5 #include "components/sync/user_events/user_event_sync_bridge.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/big_endian.h" | 9 #include "base/big_endian.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 base::Optional<ModelError> UserEventSyncBridge::MergeSyncData( | 77 base::Optional<ModelError> UserEventSyncBridge::MergeSyncData( |
| 78 std::unique_ptr<MetadataChangeList> metadata_change_list, | 78 std::unique_ptr<MetadataChangeList> metadata_change_list, |
| 79 EntityDataMap entity_data_map) { | 79 EntityDataMap entity_data_map) { |
| 80 NOTREACHED(); | 80 NOTREACHED(); |
| 81 return {}; | 81 return {}; |
| 82 } | 82 } |
| 83 | 83 |
| 84 base::Optional<ModelError> UserEventSyncBridge::ApplySyncChanges( | 84 base::Optional<ModelError> UserEventSyncBridge::ApplySyncChanges( |
| 85 std::unique_ptr<MetadataChangeList> metadata_change_list, | 85 std::unique_ptr<MetadataChangeList> metadata_change_list, |
| 86 EntityChangeList entity_changes) { | 86 EntityChangeList entity_changes) { |
| 87 NOTREACHED(); | 87 std::unique_ptr<WriteBatch> batch = store_->CreateWriteBatch(); |
| 88 for (EntityChange& change : entity_changes) { | |
| 89 DCHECK_EQ(EntityChange::ACTION_DELETE, change.type()); | |
|
Patrick Noland
2017/06/01 21:34:40
Are you sure you just want to DCHECK this conditio
skym
2017/06/01 22:43:20
The processor should never send us any other actio
| |
| 90 batch->DeleteData(change.storage_key()); | |
| 91 } | |
| 92 batch->TransferMetadataChanges(std::move(metadata_change_list)); | |
| 93 store_->CommitWriteBatch( | |
| 94 std::move(batch), | |
| 95 base::Bind(&UserEventSyncBridge::OnCommit, base::AsWeakPtr(this))); | |
| 88 return {}; | 96 return {}; |
| 89 } | 97 } |
| 90 | 98 |
| 91 void UserEventSyncBridge::GetData(StorageKeyList storage_keys, | 99 void UserEventSyncBridge::GetData(StorageKeyList storage_keys, |
| 92 DataCallback callback) { | 100 DataCallback callback) { |
| 93 store_->ReadData(storage_keys, base::Bind(&UserEventSyncBridge::OnReadData, | 101 store_->ReadData(storage_keys, base::Bind(&UserEventSyncBridge::OnReadData, |
| 94 base::AsWeakPtr(this), callback)); | 102 base::AsWeakPtr(this), callback)); |
| 95 } | 103 } |
| 96 | 104 |
| 97 void UserEventSyncBridge::GetAllData(DataCallback callback) { | 105 void UserEventSyncBridge::GetAllData(DataCallback callback) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 std::unique_ptr<WriteBatch> batch = store_->CreateWriteBatch(); | 213 std::unique_ptr<WriteBatch> batch = store_->CreateWriteBatch(); |
| 206 for (const Record& r : *data_records) { | 214 for (const Record& r : *data_records) { |
| 207 batch->DeleteData(r.id); | 215 batch->DeleteData(r.id); |
| 208 } | 216 } |
| 209 store_->CommitWriteBatch( | 217 store_->CommitWriteBatch( |
| 210 std::move(batch), | 218 std::move(batch), |
| 211 base::Bind(&UserEventSyncBridge::OnCommit, base::AsWeakPtr(this))); | 219 base::Bind(&UserEventSyncBridge::OnCommit, base::AsWeakPtr(this))); |
| 212 } | 220 } |
| 213 | 221 |
| 214 } // namespace syncer | 222 } // namespace syncer |
| OLD | NEW |