| 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 5961697873d556014b47624a69127843fcebe1e7..feb5df0855ca50dad00c039a049f28b3b9632f84 100644
|
| --- a/storage/browser/blob/blob_url_request_job_factory.cc
|
| +++ b/storage/browser/blob/blob_url_request_job_factory.cc
|
| @@ -18,6 +18,10 @@
|
| 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));
|
| +}
|
|
|
| } // namespace
|
|
|
| @@ -40,12 +44,6 @@
|
| request->SetUserData(&kUserDataKey, blob_data_handle.release());
|
| }
|
|
|
| -// static
|
| -BlobDataHandle* BlobProtocolHandler::GetRequestBlobDataHandle(
|
| - net::URLRequest* request) {
|
| - return static_cast<BlobDataHandle*>(request->GetUserData(&kUserDataKey));
|
| -}
|
| -
|
| BlobProtocolHandler::BlobProtocolHandler(
|
| BlobStorageContext* context,
|
| storage::FileSystemContext* file_system_context,
|
| @@ -61,16 +59,18 @@
|
|
|
| net::URLRequestJob* BlobProtocolHandler::MaybeCreateJob(
|
| net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
|
| - return new storage::BlobURLRequestJob(
|
| - request, network_delegate, LookupBlobHandle(request),
|
| - file_system_context_.get(), file_task_runner_.get());
|
| + return new storage::BlobURLRequestJob(request,
|
| + network_delegate,
|
| + LookupBlobData(request),
|
| + file_system_context_.get(),
|
| + file_task_runner_.get());
|
| }
|
|
|
| -BlobDataHandle* BlobProtocolHandler::LookupBlobHandle(
|
| +scoped_ptr<BlobDataSnapshot> BlobProtocolHandler::LookupBlobData(
|
| net::URLRequest* request) const {
|
| - BlobDataHandle* blob_data_handle = GetRequestBlobDataHandle(request);
|
| + BlobDataHandle* blob_data_handle = GetRequestedBlobDataHandle(request);
|
| if (blob_data_handle)
|
| - return blob_data_handle;
|
| + return blob_data_handle->CreateSnapshot().Pass();
|
| if (!context_.get())
|
| return NULL;
|
|
|
| @@ -83,11 +83,12 @@
|
| return NULL;
|
| std::string uuid = request->url().spec().substr(kPrefix.length());
|
| scoped_ptr<BlobDataHandle> handle = context_->GetBlobDataFromUUID(uuid);
|
| - BlobDataHandle* handle_ptr = handle.get();
|
| + scoped_ptr<BlobDataSnapshot> snapshot;
|
| if (handle) {
|
| + snapshot = handle->CreateSnapshot().Pass();
|
| SetRequestedBlobDataHandle(request, handle.Pass());
|
| }
|
| - return handle_ptr;
|
| + return snapshot.Pass();
|
| }
|
|
|
| } // namespace storage
|
|
|