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

Unified Diff: sync/internal_api/attachments/attachment_downloader_impl.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/attachment_downloader_impl.cc
diff --git a/sync/internal_api/attachments/attachment_downloader_impl.cc b/sync/internal_api/attachments/attachment_downloader_impl.cc
index f2e6a007aa0f1dc5dd921f4c37713b49081095d8..56a2c346d7cdb2492afb92fbeec23ef834285a77 100644
--- a/sync/internal_api/attachments/attachment_downloader_impl.cc
+++ b/sync/internal_api/attachments/attachment_downloader_impl.cc
@@ -132,7 +132,7 @@
DownloadState* download_state = *iter;
scoped_refptr<base::RefCountedString> null_attachment_data;
ReportResult(*download_state, DOWNLOAD_TRANSIENT_ERROR,
- null_attachment_data);
+ null_attachment_data, 0);
DCHECK(state_map_.find(download_state->attachment_url) != state_map_.end());
state_map_.erase(download_state->attachment_url);
}
@@ -175,13 +175,7 @@
// locally calculated one will be stored and used for further checks.
result = DOWNLOAD_TRANSIENT_ERROR;
} else {
- // If the id's crc32c doesn't match that of the downloaded attachment,
- // then we're stuck and retrying is unlikely to help.
- if (attachment_crc32c != download_state.attachment_id.GetCrc32c()) {
- result = DOWNLOAD_UNSPECIFIED_ERROR;
- } else {
- result = DOWNLOAD_SUCCESS;
- }
+ result = DOWNLOAD_SUCCESS;
}
UMA_HISTOGRAM_BOOLEAN("Sync.Attachments.DownloadChecksumResult",
result == DOWNLOAD_SUCCESS);
@@ -199,7 +193,7 @@
} else if (response_code == net::URLFetcher::RESPONSE_CODE_INVALID) {
result = DOWNLOAD_TRANSIENT_ERROR;
}
- ReportResult(download_state, result, attachment_data);
+ ReportResult(download_state, result, attachment_data, attachment_crc32c);
state_map_.erase(iter);
}
@@ -227,7 +221,8 @@
void AttachmentDownloaderImpl::ReportResult(
const DownloadState& download_state,
const DownloadResult& result,
- const scoped_refptr<base::RefCountedString>& attachment_data) {
+ const scoped_refptr<base::RefCountedString>& attachment_data,
+ uint32_t attachment_crc32c) {
std::vector<DownloadCallback>::const_iterator iter;
for (iter = download_state.user_callbacks.begin();
iter != download_state.user_callbacks.end();
@@ -235,7 +230,7 @@
scoped_ptr<Attachment> attachment;
if (result == DOWNLOAD_SUCCESS) {
attachment.reset(new Attachment(Attachment::CreateFromParts(
- download_state.attachment_id, attachment_data)));
+ download_state.attachment_id, attachment_data, attachment_crc32c)));
}
base::MessageLoop::current()->PostTask(
« no previous file with comments | « sync/engine/directory_update_handler_unittest.cc ('k') | sync/internal_api/attachments/attachment_downloader_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698