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

Unified Diff: webkit/blob/blob_storage_controller.cc

Issue 10827414: Factor out common Element struct from BlobData and ResourceRequestBody (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: webkit/common -> webkit/base 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_data.cc ('k') | webkit/blob/blob_url_request_job.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 cf5534e92890e201bfa470ac992e345655a84251..1092248dcb8fc1c25ea696f957fe12b4452b2aa8 100644
--- a/webkit/blob/blob_storage_controller.cc
+++ b/webkit/blob/blob_storage_controller.cc
@@ -67,32 +67,31 @@ void BlobStorageController::AppendBlobDataItem(
// All the Blob items in the passing blob data are resolved and expanded into
// a set of Data and File items.
- DCHECK(item.length > 0);
- switch (item.type) {
- case BlobData::TYPE_DATA:
- // WebBlobData does not allow partial data.
- DCHECK(!(item.offset) && item.length == item.data.size());
- target_blob_data->AppendData(item.data.c_str(), item.data.size());
+ DCHECK(item.length() > 0);
+ switch (item.type()) {
+ case BlobData::Item::TYPE_BYTES:
+ DCHECK(!item.offset());
+ target_blob_data->AppendData(item.bytes(), item.length());
break;
- case BlobData::TYPE_DATA_EXTERNAL:
- DCHECK(!item.offset);
- target_blob_data->AppendData(item.data_external, item.length);
- break;
- case BlobData::TYPE_FILE:
+ case BlobData::Item::TYPE_FILE:
AppendFileItem(target_blob_data,
- item.file_path,
- item.offset,
- item.length,
- item.expected_modification_time);
+ item.path(),
+ item.offset(),
+ item.length(),
+ item.expected_modification_time());
break;
- case BlobData::TYPE_BLOB:
- BlobData* src_blob_data = GetBlobDataFromUrl(item.blob_url);
+ case BlobData::Item::TYPE_BLOB: {
+ BlobData* src_blob_data = GetBlobDataFromUrl(item.url());
DCHECK(src_blob_data);
if (src_blob_data)
AppendStorageItems(target_blob_data,
src_blob_data,
- item.offset,
- item.length);
+ item.offset(),
+ item.length());
+ break;
+ }
+ default:
+ NOTREACHED();
break;
}
@@ -178,27 +177,27 @@ void BlobStorageController::AppendStorageItems(
src_blob_data->items().begin();
if (offset) {
for (; iter != src_blob_data->items().end(); ++iter) {
- if (offset >= iter->length)
- offset -= iter->length;
+ if (offset >= iter->length())
+ offset -= iter->length();
else
break;
}
}
for (; iter != src_blob_data->items().end() && length > 0; ++iter) {
- uint64 current_length = iter->length - offset;
+ uint64 current_length = iter->length() - offset;
uint64 new_length = current_length > length ? length : current_length;
- if (iter->type == BlobData::TYPE_DATA) {
+ if (iter->type() == BlobData::Item::TYPE_BYTES) {
target_blob_data->AppendData(
- iter->data.c_str() + static_cast<size_t>(iter->offset + offset),
+ iter->bytes() + static_cast<size_t>(iter->offset() + offset),
static_cast<uint32>(new_length));
} else {
- DCHECK(iter->type == BlobData::TYPE_FILE);
+ DCHECK(iter->type() == BlobData::Item::TYPE_FILE);
AppendFileItem(target_blob_data,
- iter->file_path,
- iter->offset + offset,
+ iter->path(),
+ iter->offset() + offset,
new_length,
- iter->expected_modification_time);
+ iter->expected_modification_time());
}
length -= new_length;
offset = 0;
« no previous file with comments | « webkit/blob/blob_data.cc ('k') | webkit/blob/blob_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698