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

Unified Diff: content/browser/blob_storage/chrome_blob_storage_context.cc

Issue 2960023002: Remove SupportsUserData from ResourceRequestBodyImpl. (Closed)
Patch Set: .... Created 3 years, 6 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: content/browser/blob_storage/chrome_blob_storage_context.cc
diff --git a/content/browser/blob_storage/chrome_blob_storage_context.cc b/content/browser/blob_storage/chrome_blob_storage_context.cc
index 28734c2b4f99256f455f89376bd54f37bceabd71..bb1a39515e05040400bbfdabb9a89a3de90e3150 100644
--- a/content/browser/blob_storage/chrome_blob_storage_context.cc
+++ b/content/browser/blob_storage/chrome_blob_storage_context.cc
@@ -14,6 +14,7 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h"
+#include "base/supports_user_data.h"
#include "base/task_runner.h"
#include "base/task_scheduler/post_task.h"
#include "content/browser/resource_context_impl.h"
@@ -22,7 +23,6 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "storage/browser/blob/blob_data_builder.h"
-#include "storage/browser/blob/blob_data_handle.h"
#include "storage/browser/blob/blob_memory_controller.h"
#include "storage/browser/blob/blob_storage_context.h"
@@ -197,11 +197,14 @@ storage::BlobStorageContext* GetBlobStorageContext(
return blob_storage_context->context();
}
-bool AttachRequestBodyBlobDataHandles(ResourceRequestBodyImpl* body,
- ResourceContext* resource_context) {
+std::unique_ptr<BlobHandles> GetBodyBlobDataHandles(
+ ResourceRequestBodyImpl* body,
+ ResourceContext* resource_context) {
storage::BlobStorageContext* blob_context = GetBlobStorageContext(
GetChromeBlobStorageContextForResourceContext(resource_context));
+ std::unique_ptr<BlobHandles> blob_handles(new BlobHandles());
+
DCHECK(blob_context);
for (size_t i = 0; i < body->elements()->size(); ++i) {
const ResourceRequestBodyImpl::Element& element = (*body->elements())[i];
@@ -210,13 +213,10 @@ bool AttachRequestBodyBlobDataHandles(ResourceRequestBodyImpl* body,
std::unique_ptr<storage::BlobDataHandle> handle =
blob_context->GetBlobDataFromUUID(element.blob_uuid());
if (!handle)
- return false;
- // Ensure the blob and any attached shareable files survive until
- // upload completion. The |body| takes ownership of |handle|.
- const void* key = handle.get();
- body->SetUserData(key, std::move(handle));
+ return nullptr;
+ blob_handles->push_back(std::move(handle));
}
- return true;
+ return blob_handles;
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698