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

Unified Diff: webkit/blob/blob_storage_controller.cc

Issue 10834289: Split net::UploadData into two: for IPC and for upload handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + moved ResolveBlobRef from webkit_blob to webkit_glue Created 8 years, 4 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/blob/blob_storage_controller.h ('k') | webkit/blob/blob_storage_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/blob/blob_storage_controller.cc
diff --git a/webkit/blob/blob_storage_controller.cc b/webkit/blob/blob_storage_controller.cc
index 6a10811bab0d1c0cda633b19de525d02bde68a19..cf5534e92890e201bfa470ac992e345655a84251 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) {
« no previous file with comments | « webkit/blob/blob_storage_controller.h ('k') | webkit/blob/blob_storage_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698