Chromium Code Reviews| Index: content/browser/loader/upload_data_stream_builder.cc |
| diff --git a/content/browser/loader/upload_data_stream_builder.cc b/content/browser/loader/upload_data_stream_builder.cc |
| index 376e221d2a6e2ebd8b7f26247ecb6a9b57697a12..66ab032f3d9ec33854cc020c2f5692d3161d5d8b 100644 |
| --- a/content/browser/loader/upload_data_stream_builder.cc |
| +++ b/content/browser/loader/upload_data_stream_builder.cc |
| @@ -12,10 +12,7 @@ |
| #include "net/base/upload_file_element_reader.h" |
| #include "storage/browser/blob/blob_data_handle.h" |
| #include "storage/browser/blob/blob_storage_context.h" |
| - |
| -using storage::BlobData; |
| -using storage::BlobDataHandle; |
| -using storage::BlobStorageContext; |
| +#include "storage/common/blob/blob_data.h" |
| namespace content { |
| namespace { |
| @@ -74,15 +71,20 @@ void ResolveBlobReference( |
| if (!handle) |
| return; |
| + // TODO(dmurph): store this snapshot. This works for now, as the items |
|
mmenke
2015/01/20 22:03:57
nit: Capitalize S
dmurph
2015/01/21 22:40:11
Done.
|
| + // that the snapshot points to are refcounted and kept in memory. But as |
|
mmenke
2015/01/20 22:03:57
Should mention that they're attached to the reques
dmurph
2015/01/21 22:40:11
Done.
|
| + // soon as we implement evicting to disk this will break, so we need a reader |
| + // that can store this snapshot and have it used below instead of this |
| + // decomposition. |
|
michaeln
2015/01/21 01:46:41
It would be really good to store snapshots in this
dmurph
2015/01/21 22:40:11
Done.
|
| + scoped_ptr<storage::BlobDataSnapshot> snapshot = handle->CreateSnapshot(); |
| // If there is no element in the referred blob data, just return. |
| - if (handle->data()->items().empty()) |
| + if (snapshot->items().empty()) |
| return; |
| // Append the elements in the referenced blob data. |
| - for (size_t i = 0; i < handle->data()->items().size(); ++i) { |
| - const BlobData::Item& item = handle->data()->items().at(i); |
| - DCHECK_NE(BlobData::Item::TYPE_BLOB, item.type()); |
| - resolved_elements->push_back(&item); |
| + for (const auto& item : snapshot->items()) { |
| + DCHECK_NE(storage::DataElement::TYPE_BLOB, item->type()); |
| + resolved_elements->push_back(item->data_element_ptr()); |
| } |
| } |
| @@ -90,7 +92,7 @@ void ResolveBlobReference( |
| scoped_ptr<net::UploadDataStream> UploadDataStreamBuilder::Build( |
| ResourceRequestBody* body, |
| - BlobStorageContext* blob_context, |
| + storage::BlobStorageContext* blob_context, |
| storage::FileSystemContext* file_system_context, |
| base::TaskRunner* file_task_runner) { |
| // Resolve all blob elements. |
| @@ -128,6 +130,7 @@ scoped_ptr<net::UploadDataStream> UploadDataStreamBuilder::Build( |
| break; |
| case ResourceRequestBody::Element::TYPE_BLOB: |
| // Blob elements should be resolved beforehand. |
| + // TODO(dmurph): Create blob reader and store the snapshot in there. |
| NOTREACHED(); |
| break; |
| case ResourceRequestBody::Element::TYPE_UNKNOWN: |