Chromium Code Reviews| Index: webkit/blob/blob_storage_controller.cc |
| diff --git a/webkit/blob/blob_storage_controller.cc b/webkit/blob/blob_storage_controller.cc |
| index 79508fc4b39c693edaf6e49f7a21b90db2276f0c..6a114bcea9d37e1d36d2561f3abe4883de303ce1 100644 |
| --- a/webkit/blob/blob_storage_controller.cc |
| +++ b/webkit/blob/blob_storage_controller.cc |
| @@ -6,8 +6,10 @@ |
| #include "base/logging.h" |
| #include "googleurl/src/gurl.h" |
| -#include "net/base/upload_data.h" |
| #include "webkit/blob/blob_data.h" |
| +#include "webkit/glue/resource_request_body.h" |
| + |
| +using webkit_glue::ResourceRequestBody; |
| namespace webkit_blob { |
| @@ -169,15 +171,15 @@ BlobData* BlobStorageController::GetBlobDataFromUrl(const GURL& url) { |
| return (found != blob_map_.end()) ? found->second : NULL; |
| } |
| -void BlobStorageController::ResolveBlobReferencesInUploadData( |
| - net::UploadData* upload_data) { |
| - DCHECK(upload_data); |
| +void BlobStorageController::ResolveBlobReferencesInResourceRequestBody( |
|
darin (slow to review)
2012/08/15 17:49:55
nit: I'd be OK dropping the "Resource" in this fun
kinuko
2012/08/16 08:14:59
Done.
|
| + ResourceRequestBody* resource_request_body) { |
| + DCHECK(resource_request_body); |
| - std::vector<net::UploadData::Element>* uploads = |
| - upload_data->elements_mutable(); |
| - std::vector<net::UploadData::Element>::iterator iter; |
| + std::vector<ResourceRequestBody::Element>* uploads = |
| + resource_request_body->elements_mutable(); |
| + std::vector<ResourceRequestBody::Element>::iterator iter; |
| for (iter = uploads->begin(); iter != uploads->end();) { |
| - if (iter->type() != net::UploadData::TYPE_BLOB) { |
| + if (iter->type() != ResourceRequestBody::TYPE_BLOB) { |
| iter++; |
| continue; |
| } |
| @@ -202,22 +204,19 @@ void BlobStorageController::ResolveBlobReferencesInUploadData( |
| // Ensure the blob and any attached shareable files survive until |
| // upload completion. |
| - upload_data->SetUserData(blob_data, |
| - new base::UserDataAdapter<BlobData>(blob_data)); |
| + resource_request_body->SetUserData( |
| + blob_data, new base::UserDataAdapter<BlobData>(blob_data)); |
| // Insert the elements in the referred blob data. |
| // Note that we traverse from the bottom so that the elements can be |
| // inserted in the original order. |
| for (size_t i = blob_data->items().size(); i > 0; --i) { |
| - iter = uploads->insert(iter, net::UploadData::Element()); |
| + iter = uploads->insert(iter, ResourceRequestBody::Element()); |
| const BlobData::Item& item = blob_data->items().at(i - 1); |
| switch (item.type) { |
| case BlobData::TYPE_DATA: |
| - // TODO(jianli): Figure out how to avoid copying the data. |
| - // TODO(michaeln): Now that blob_data surives for the duration, |
| - // maybe UploadData could take a raw ptr without having to copy. |
| - iter->SetToBytes( |
| + iter->SetToSharedBytes( |
| &item.data.at(0) + static_cast<int>(item.offset), |
| static_cast<int>(item.length)); |
| break; |