Chromium Code Reviews| Index: content/browser/storage_partition_impl_map.cc |
| diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc |
| index 75c4898d2504db1abe565af9349c8e15c9544bd7..cac5c275843cc15f92264910565582b4f81c6563 100644 |
| --- a/content/browser/storage_partition_impl_map.cc |
| +++ b/content/browser/storage_partition_impl_map.cc |
| @@ -22,6 +22,9 @@ |
| #include "content/browser/net/view_http_cache_job_factory.h" |
| #include "content/browser/resource_context_impl.h" |
| #include "content/browser/storage_partition_impl.h" |
| +#include "content/browser/streams/chrome_stream_context.h" |
| +#include "content/browser/streams/chrome_stream_registry.h" |
| +#include "content/browser/streams/stream_url_request_job.h" |
| #include "content/browser/webui/url_data_manager_backend.h" |
| #include "content/browser/tcmalloc_internals_request_job.h" |
| #include "content/public/browser/browser_context.h" |
| @@ -49,8 +52,10 @@ namespace { |
| class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { |
| public: |
| BlobProtocolHandler(ChromeBlobStorageContext* blob_storage_context, |
| + ChromeStreamContext* stream_context, |
| fileapi::FileSystemContext* file_system_context) |
| : blob_storage_context_(blob_storage_context), |
| + stream_context_(stream_context), |
| file_system_context_(file_system_context) {} |
| virtual ~BlobProtocolHandler() {} |
| @@ -62,6 +67,7 @@ class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { |
| if (!webkit_blob_protocol_handler_impl_) { |
| webkit_blob_protocol_handler_impl_.reset( |
| new WebKitBlobProtocolHandlerImpl(blob_storage_context_->controller(), |
| + stream_context_, |
| file_system_context_)); |
| } |
| return webkit_blob_protocol_handler_impl_->MaybeCreateJob(request, |
| @@ -76,14 +82,29 @@ class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { |
| public: |
| WebKitBlobProtocolHandlerImpl( |
| webkit_blob::BlobStorageController* blob_storage_controller, |
| + ChromeStreamContext* stream_context, |
| fileapi::FileSystemContext* file_system_context) |
| : webkit_blob::BlobProtocolHandler( |
| blob_storage_controller, file_system_context, |
| BrowserThread::GetMessageLoopProxyForThread( |
| - BrowserThread::FILE)) {} |
| + BrowserThread::FILE)), |
| + stream_context_(stream_context) {} |
| virtual ~WebKitBlobProtocolHandlerImpl() {} |
| + virtual net::URLRequestJob* MaybeCreateJob( |
| + net::URLRequest* request, |
| + net::NetworkDelegate* network_delegate) const { |
| + scoped_refptr<ChromeStream> stream = |
| + stream_context_->registry()->GetStream(request->url()); |
| + if (stream) { |
| + return new StreamURLRequestJob(request, network_delegate, stream); |
| + } else { |
|
darin (slow to review)
2013/02/13 09:18:12
nit: no need for else after return.
Zachary Kuznia
2013/02/13 16:37:14
Done.
|
| + return webkit_blob::BlobProtocolHandler::MaybeCreateJob( |
| + request, network_delegate); |
| + } |
| + } |
| + |
| private: |
| // webkit_blob::BlobProtocolHandler implementation. |
| virtual scoped_refptr<webkit_blob::BlobData> |
| @@ -95,10 +116,12 @@ class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { |
| return info->requested_blob_data(); |
| } |
| + const scoped_refptr<ChromeStreamContext> stream_context_; |
| DISALLOW_COPY_AND_ASSIGN(WebKitBlobProtocolHandlerImpl); |
| }; |
| const scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
| + const scoped_refptr<ChromeStreamContext> stream_context_; |
| const scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
| mutable scoped_ptr<WebKitBlobProtocolHandlerImpl> |
| @@ -447,9 +470,13 @@ StoragePartitionImpl* StoragePartitionImplMap::Get( |
| ChromeBlobStorageContext* blob_storage_context = |
| ChromeBlobStorageContext::GetFor(browser_context_); |
| + ChromeStreamContext* stream_context = |
| + ChromeStreamContext::GetFor(browser_context_); |
| scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler( |
| - new BlobProtocolHandler(blob_storage_context, |
| - partition->GetFileSystemContext())); |
| + new BlobProtocolHandler( |
| + blob_storage_context, |
| + stream_context, |
| + partition->GetFileSystemContext())); |
| scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| file_system_protocol_handler( |
| CreateFileSystemProtocolHandler(partition->GetFileSystemContext())); |