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

Unified Diff: webkit/glue/resource_request_body.cc

Issue 11410019: ********** Chromium Blob hacking (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 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
« no previous file with comments | « webkit/glue/resource_request_body.h ('k') | webkit/glue/weburlloader_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/resource_request_body.cc
===================================================================
--- webkit/glue/resource_request_body.cc (revision 183651)
+++ webkit/glue/resource_request_body.cc (working copy)
@@ -8,11 +8,11 @@
#include "net/base/upload_bytes_element_reader.h"
#include "net/base/upload_data_stream.h"
#include "net/base/upload_file_element_reader.h"
-#include "webkit/blob/blob_storage_controller.h"
+#include "webkit/blob/blob_storage_context.h"
#include "webkit/fileapi/upload_file_system_file_element_reader.h"
using webkit_blob::BlobData;
-using webkit_blob::BlobStorageController;
+using webkit_blob::BlobStorageContext;
namespace webkit_glue {
@@ -81,9 +81,9 @@
expected_modification_time);
}
-void ResourceRequestBody::AppendBlob(const GURL& blob_url) {
+void ResourceRequestBody::AppendBlob(const std::string& uuid) {
elements_.push_back(Element());
- elements_.back().SetToBlobUrl(blob_url);
+ elements_.back().SetToBlob(uuid);
}
void ResourceRequestBody::AppendFileSystemFileRange(
@@ -96,7 +96,7 @@
net::UploadDataStream*
ResourceRequestBody::ResolveElementsAndCreateUploadDataStream(
- BlobStorageController* blob_controller,
+ BlobStorageContext* blob_context,
fileapi::FileSystemContext* file_system_context,
base::TaskRunner* file_task_runner) {
// Resolve all blob elements.
@@ -104,7 +104,8 @@
for (size_t i = 0; i < elements_.size(); ++i) {
const Element& element = elements_[i];
if (element.type() == Element::TYPE_BLOB) {
- ResolveBlobReference(blob_controller, element.url(), &resolved_elements);
+ ResolveBlobReference(blob_context, element.blob_uuid(),
+ &resolved_elements);
} else {
// No need to resolve, just append the element.
resolved_elements.push_back(&element);
@@ -126,7 +127,7 @@
element_readers.push_back(
new fileapi::UploadFileSystemFileElementReader(
file_system_context,
- element.url(),
+ element.filesystem_url(),
element.offset(),
element.length(),
element.expected_modification_time()));
@@ -146,29 +147,30 @@
ResourceRequestBody::~ResourceRequestBody() {}
void ResourceRequestBody::ResolveBlobReference(
- webkit_blob::BlobStorageController* blob_controller,
- const GURL& blob_url,
+ webkit_blob::BlobStorageContext* blob_context,
+ const std::string& uuid,
std::vector<const Element*>* resolved_elements) {
- DCHECK(blob_controller);
- BlobData* blob_data = blob_controller->GetBlobDataFromUrl(blob_url);
- DCHECK(blob_data);
- if (!blob_data)
+ DCHECK(blob_context);
+ scoped_ptr<webkit_blob::BlobDataHandle> handle =
+ blob_context->GetBlobDataFromUUID(uuid);
+ DCHECK(handle);
+ if (!handle)
return;
// If there is no element in the referred blob data, just return.
- if (blob_data->items().empty())
+ if (handle->data()->items().empty())
return;
- // Ensure the blob and any attached shareable files survive until
- // upload completion.
- SetUserData(blob_data, new base::UserDataAdapter<BlobData>(blob_data));
-
// Append the elements in the referred blob data.
- for (size_t i = 0; i < blob_data->items().size(); ++i) {
- const BlobData::Item& item = blob_data->items().at(i);
+ for (size_t i = 0; i < handle->data()->items().size(); ++i) {
+ const BlobData::Item& item = handle->data()->items().at(i);
DCHECK_NE(BlobData::Item::TYPE_BLOB, item.type());
resolved_elements->push_back(&item);
}
+
+ // Ensure the blob and any attached shareable files survive until
+ // upload completion.
+ SetUserData(handle.get(), handle.release());
}
} // namespace webkit_glue
« no previous file with comments | « webkit/glue/resource_request_body.h ('k') | webkit/glue/weburlloader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698