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

Unified Diff: webkit/blob/blob_url_request_job.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_storage_controller.cc ('k') | webkit/blob/view_blob_internals_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/blob/blob_url_request_job.cc
diff --git a/webkit/blob/blob_url_request_job.cc b/webkit/blob/blob_url_request_job.cc
index 80e382b554a9685141050e48fa23da99b867999f..edda7fcaa5d51bdc56ae3d51ca65b0e59c84557f 100644
--- a/webkit/blob/blob_url_request_job.cc
+++ b/webkit/blob/blob_url_request_job.cc
@@ -176,7 +176,7 @@ void BlobURLRequestJob::CountSize() {
for (size_t i = 0; i < blob_data_->items().size(); ++i) {
const BlobData::Item& item = blob_data_->items().at(i);
- if (item.type == BlobData::TYPE_FILE) {
+ if (item.type() == BlobData::Item::TYPE_FILE) {
++pending_get_file_info_count_;
GetFileStreamReader(i)->GetLength(
base::Bind(&BlobURLRequestJob::DidGetFileItemLength,
@@ -184,7 +184,7 @@ void BlobURLRequestJob::CountSize() {
continue;
}
// Cache the size and add it to the total size.
- int64 item_length = static_cast<int64>(item.length);
+ int64 item_length = static_cast<int64>(item.length());
item_length_list_[i] = item_length;
total_size_ += item_length;
}
@@ -234,13 +234,13 @@ void BlobURLRequestJob::DidGetFileItemLength(size_t index, int64 result) {
DCHECK_LT(index, blob_data_->items().size());
const BlobData::Item& item = blob_data_->items().at(index);
- DCHECK(item.type == BlobData::TYPE_FILE);
+ DCHECK(item.type() == BlobData::Item::TYPE_FILE);
// If item length is -1, we need to use the file size being resolved
// in the real time.
- int64 item_length = static_cast<int64>(item.length);
+ int64 item_length = static_cast<int64>(item.length());
if (item_length == -1)
- item_length = result - item.offset;
+ item_length = result - item.offset();
// Cache the size and add it to the total size.
DCHECK_LT(index, item_length_list_.size());
@@ -268,13 +268,13 @@ void BlobURLRequestJob::Seek(int64 offset) {
// Adjust the offset of the first stream if it is of file type.
const BlobData::Item& item = blob_data_->items().at(current_item_index_);
- if (item.type == BlobData::TYPE_FILE) {
+ if (item.type() == BlobData::Item::TYPE_FILE) {
DeleteCurrentFileReader();
index_to_reader_[current_item_index_] = new LocalFileStreamReader(
file_thread_proxy_,
- item.file_path,
- item.offset + offset,
- item.expected_modification_time);
+ item.path(),
+ item.offset() + offset,
+ item.expected_modification_time());
}
}
@@ -301,10 +301,10 @@ bool BlobURLRequestJob::ReadItem() {
// Do the reading.
const BlobData::Item& item = blob_data_->items().at(current_item_index_);
- switch (item.type) {
- case BlobData::TYPE_DATA:
+ switch (item.type()) {
+ case BlobData::Item::TYPE_BYTES:
return ReadBytesItem(item, bytes_to_read);
- case BlobData::TYPE_FILE:
+ case BlobData::Item::TYPE_FILE:
return ReadFileItem(GetFileStreamReader(current_item_index_),
bytes_to_read);
default:
@@ -344,7 +344,7 @@ bool BlobURLRequestJob::ReadBytesItem(const BlobData::Item& item,
DCHECK_GE(read_buf_->BytesRemaining(), bytes_to_read);
memcpy(read_buf_->data(),
- &item.data.at(0) + item.offset + current_item_offset_,
+ item.bytes() + item.offset() + current_item_offset_,
bytes_to_read);
AdvanceBytesRead(bytes_to_read);
@@ -527,14 +527,14 @@ void BlobURLRequestJob::HeadersCompleted(int status_code,
LocalFileStreamReader* BlobURLRequestJob::GetFileStreamReader(size_t index) {
DCHECK_LT(index, blob_data_->items().size());
const BlobData::Item& item = blob_data_->items().at(index);
- if (item.type != BlobData::TYPE_FILE)
+ if (item.type() != BlobData::Item::TYPE_FILE)
return NULL;
if (index_to_reader_.find(index) == index_to_reader_.end()) {
index_to_reader_[index] = new LocalFileStreamReader(
file_thread_proxy_,
- item.file_path,
- item.offset,
- item.expected_modification_time);
+ item.path(),
+ item.offset(),
+ item.expected_modification_time());
}
DCHECK(index_to_reader_[index]);
return index_to_reader_[index];
« no previous file with comments | « webkit/blob/blob_storage_controller.cc ('k') | webkit/blob/view_blob_internals_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698