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

Unified Diff: sync/internal_api/attachments/on_disk_attachment_store.cc

Issue 995683002: Revert of [Sync] Add size and crc32c to AttachmentId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/attachments/on_disk_attachment_store.cc
diff --git a/sync/internal_api/attachments/on_disk_attachment_store.cc b/sync/internal_api/attachments/on_disk_attachment_store.cc
index 699e1f5add122106a7f7030881e3c9731d295c2d..ec6fc75931bd9283d50033f4b055f9f52f514717 100644
--- a/sync/internal_api/attachments/on_disk_attachment_store.cc
+++ b/sync/internal_api/attachments/on_disk_attachment_store.cc
@@ -319,18 +319,12 @@
scoped_refptr<base::RefCountedMemory> data =
base::RefCountedString::TakeString(&data_str);
uint32_t crc32c = ComputeCrc32c(data);
- if (record_metadata.has_crc32c()) {
- if (record_metadata.crc32c() != crc32c) {
- DVLOG(1) << "Attachment crc32c does not match value read from store";
- return attachment.Pass();
- }
- if (record_metadata.crc32c() != attachment_id.GetCrc32c()) {
- DVLOG(1) << "Attachment crc32c does not match value in AttachmentId";
- return attachment.Pass();
- }
+ if (record_metadata.has_crc32c() && record_metadata.crc32c() != crc32c) {
+ DVLOG(1) << "Attachment crc does not match";
+ return attachment.Pass();
}
attachment.reset(
- new Attachment(Attachment::CreateFromParts(attachment_id, data)));
+ new Attachment(Attachment::CreateFromParts(attachment_id, data, crc32c)));
return attachment.Pass();
}

Powered by Google App Engine
This is Rietveld 408576698