diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-21 13:57:42 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-21 13:57:42 +0000 |
commit | e3e402c11b05ae0562199543ca6a17e09bbab6b2 (patch) | |
tree | e6d1bf0123934b7580a302ae35467f3fd4c3ada6 /webkit/blob/blob_storage_controller.cc | |
parent | 4b88b74e5e7ccf857104b2212518c65940489699 (diff) | |
download | chromium_src-e3e402c11b05ae0562199543ca6a17e09bbab6b2.zip chromium_src-e3e402c11b05ae0562199543ca6a17e09bbab6b2.tar.gz chromium_src-e3e402c11b05ae0562199543ca6a17e09bbab6b2.tar.bz2 |
Split net::UploadData into two: for resource request IPC and for upload handling
Introducing webkit_glue::ResourceRequestBody as a content-level abstraction corresponding to WebHTTPBody and as an alternative of net::UploadData in ResourceRequest.
This interface can contain content-level objects like Blob (or FileSystem URL in later patches) while net::UploadData should NOT.
This patch also removes Blob support in net::UploadData.
BUG=110119
TEST=existing tests
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=152528
Review URL: https://chromiumcodereview.appspot.com/10834289
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152553 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/blob/blob_storage_controller.cc')
-rw-r--r-- | webkit/blob/blob_storage_controller.cc | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/webkit/blob/blob_storage_controller.cc b/webkit/blob/blob_storage_controller.cc index 6a10811..cf5534e 100644 --- a/webkit/blob/blob_storage_controller.cc +++ b/webkit/blob/blob_storage_controller.cc @@ -6,7 +6,6 @@ #include "base/logging.h" #include "googleurl/src/gurl.h" -#include "net/base/upload_data.h" #include "webkit/blob/blob_data.h" namespace webkit_blob { @@ -169,73 +168,6 @@ BlobData* BlobStorageController::GetBlobDataFromUrl(const GURL& url) { return (found != blob_map_.end()) ? found->second : NULL; } -void BlobStorageController::ResolveBlobReferencesInUploadData( - net::UploadData* upload_data) { - DCHECK(upload_data); - - std::vector<net::UploadElement>* uploads = - upload_data->elements_mutable(); - std::vector<net::UploadElement>::iterator iter; - for (iter = uploads->begin(); iter != uploads->end();) { - if (iter->type() != net::UploadElement::TYPE_BLOB) { - iter++; - continue; - } - - // Find the referred blob data. - BlobData* blob_data = GetBlobDataFromUrl(iter->blob_url()); - DCHECK(blob_data); - if (!blob_data) { - // TODO(jianli): We should probably fail uploading the data - iter++; - continue; - } - - // Remove this element. - iter = uploads->erase(iter); - - // If there is no element in the referred blob data, continue the loop. - // Note that we should not increase iter since it already points to the one - // after the removed element. - if (blob_data->items().empty()) - continue; - - // Ensure the blob and any attached shareable files survive until - // upload completion. - upload_data->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::UploadElement()); - - 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( - &item.data.at(0) + static_cast<int>(item.offset), - static_cast<int>(item.length)); - break; - case BlobData::TYPE_FILE: - iter->SetToFilePathRange( - item.file_path, - item.offset, - item.length, - item.expected_modification_time); - break; - default: - NOTREACHED(); - break; - } - } - } -} - void BlobStorageController::AppendStorageItems( BlobData* target_blob_data, BlobData* src_blob_data, uint64 offset, uint64 length) { |