Index: storage/browser/blob/blob_url_request_job_factory.cc |
diff --git a/storage/browser/blob/blob_url_request_job_factory.cc b/storage/browser/blob/blob_url_request_job_factory.cc |
index 60f9c738b9e74245871d167d2c9c2b8eb9bd3d6e..c834990d41e0f9cf983f0b88bed7391772e42025 100644 |
--- a/storage/browser/blob/blob_url_request_job_factory.cc |
+++ b/storage/browser/blob/blob_url_request_job_factory.cc |
@@ -22,15 +22,16 @@ namespace { |
int kUserDataKey; // The value is not important, the addr is a key. |
-BlobDataHandle* GetRequestedBlobDataHandle(net::URLRequest* request) { |
- return static_cast<BlobDataHandle*>(request->GetUserData(&kUserDataKey)); |
+BlobDataSnapshotHandle* GetRequestedBlobDataHandle(net::URLRequest* request) { |
+ return static_cast<BlobDataSnapshotHandle*>( |
+ request->GetUserData(&kUserDataKey)); |
} |
} // namespace |
// static |
scoped_ptr<net::URLRequest> BlobProtocolHandler::CreateBlobRequest( |
- scoped_ptr<BlobDataHandle> blob_data_handle, |
+ scoped_ptr<BlobDataSnapshotHandle> blob_data_handle, |
const net::URLRequestContext* request_context, |
net::URLRequest::Delegate* request_delegate) { |
const GURL kBlobUrl("blob://see_user_data/"); |
@@ -43,7 +44,7 @@ scoped_ptr<net::URLRequest> BlobProtocolHandler::CreateBlobRequest( |
// static |
void BlobProtocolHandler::SetRequestedBlobDataHandle( |
net::URLRequest* request, |
- scoped_ptr<BlobDataHandle> blob_data_handle) { |
+ scoped_ptr<BlobDataSnapshotHandle> blob_data_handle) { |
request->SetUserData(&kUserDataKey, blob_data_handle.release()); |
} |
@@ -68,9 +69,10 @@ net::URLRequestJob* BlobProtocolHandler::MaybeCreateJob( |
file_loop_proxy_.get()); |
} |
-scoped_refptr<storage::BlobData> BlobProtocolHandler::LookupBlobData( |
+const storage::BlobDataSnapshot* BlobProtocolHandler::LookupBlobData( |
net::URLRequest* request) const { |
- BlobDataHandle* blob_data_handle = GetRequestedBlobDataHandle(request); |
+ BlobDataSnapshotHandle* blob_data_handle = |
+ GetRequestedBlobDataHandle(request); |
if (blob_data_handle) |
return blob_data_handle->data(); |
if (!context_.get()) |
@@ -83,8 +85,14 @@ scoped_refptr<storage::BlobData> BlobProtocolHandler::LookupBlobData( |
if (!StartsWithASCII(request->url().spec(), kPrefix, true)) |
return NULL; |
std::string uuid = request->url().spec().substr(kPrefix.length()); |
- scoped_ptr<BlobDataHandle> handle = context_->GetBlobDataFromUUID(uuid); |
- return handle.get() ? handle->data() : NULL; |
+ scoped_ptr<BlobDataSnapshotHandle> handle = |
+ context_->GetBlobDataFromUUID(uuid); |
+ const BlobDataSnapshot* snapshot = nullptr; |
+ if (handle) { |
+ snapshot = handle->data(); |
+ SetRequestedBlobDataHandle(request, handle.Pass()); |
+ } |
+ return snapshot; |
} |
} // namespace storage |