Chromium Code Reviews| Index: content/browser/cache_storage/cache_storage_cache.cc |
| diff --git a/content/browser/cache_storage/cache_storage_cache.cc b/content/browser/cache_storage/cache_storage_cache.cc |
| index ab57e308e7ed83047e758a4eefee852f8827f2ce..d2f7cec661c0b055f5dc6a6dd3e0203f2420f1e3 100644 |
| --- a/content/browser/cache_storage/cache_storage_cache.cc |
| +++ b/content/browser/cache_storage/cache_storage_cache.cc |
| @@ -19,7 +19,7 @@ |
| #include "net/base/io_buffer.h" |
| #include "net/base/net_errors.h" |
| #include "net/disk_cache/disk_cache.h" |
| -#include "net/url_request/url_request_context.h" |
| +#include "net/url_request/url_request_context_getter.h" |
| #include "storage/browser/blob/blob_data_builder.h" |
| #include "storage/browser/blob/blob_data_handle.h" |
| #include "storage/browser/blob/blob_storage_context.h" |
| @@ -178,15 +178,19 @@ class CacheStorageCache::BlobReader : public net::URLRequest::Delegate { |
| weak_ptr_factory_(this) {} |
| // |entry| is passed to the callback once complete. |
| - void StreamBlobToCache(disk_cache::ScopedEntryPtr entry, |
| - net::URLRequestContext* request_context, |
| - scoped_ptr<storage::BlobDataHandle> blob_data_handle, |
| - const EntryAndBoolCallback& callback) { |
| + void StreamBlobToCache( |
| + disk_cache::ScopedEntryPtr entry, |
| + const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| + scoped_ptr<storage::BlobDataHandle> blob_data_handle, |
| + const EntryAndBoolCallback& callback) { |
| DCHECK(entry); |
| + DCHECK(request_context->GetURLRequestContext()); |
|
mmenke
2015/06/10 17:00:31
Do we have a strong guarantee that if we shut down
jkarlin
2015/06/10 18:26:03
This is only called via blink->...->RenderProcessH
|
| + |
| entry_ = entry.Pass(); |
| callback_ = callback; |
| + |
| blob_request_ = storage::BlobProtocolHandler::CreateBlobRequest( |
| - blob_data_handle.Pass(), request_context, this); |
| + blob_data_handle.Pass(), request_context->GetURLRequestContext(), this); |
| blob_request_->Start(); |
| } |
| @@ -341,7 +345,7 @@ struct CacheStorageCache::PutContext { |
| scoped_ptr<ServiceWorkerResponse> response, |
| scoped_ptr<storage::BlobDataHandle> blob_data_handle, |
| const CacheStorageCache::ErrorCallback& callback, |
| - net::URLRequestContext* request_context, |
| + const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy) |
| : origin(origin), |
| request(request.Pass()), |
| @@ -362,7 +366,7 @@ struct CacheStorageCache::PutContext { |
| scoped_ptr<ServiceWorkerResponse> response; |
| scoped_ptr<storage::BlobDataHandle> blob_data_handle; |
| CacheStorageCache::ErrorCallback callback; |
| - net::URLRequestContext* request_context; |
| + scoped_refptr<net::URLRequestContextGetter> request_context; |
| scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy; |
| // This isn't a scoped_ptr because the disk_cache needs an Entry** as input to |
| @@ -375,7 +379,7 @@ struct CacheStorageCache::PutContext { |
| // static |
| scoped_refptr<CacheStorageCache> CacheStorageCache::CreateMemoryCache( |
| const GURL& origin, |
| - net::URLRequestContext* request_context, |
| + const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy, |
| base::WeakPtr<storage::BlobStorageContext> blob_context) { |
| return make_scoped_refptr( |
| @@ -387,7 +391,7 @@ scoped_refptr<CacheStorageCache> CacheStorageCache::CreateMemoryCache( |
| scoped_refptr<CacheStorageCache> CacheStorageCache::CreatePersistentCache( |
| const GURL& origin, |
| const base::FilePath& path, |
| - net::URLRequestContext* request_context, |
| + const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy, |
| base::WeakPtr<storage::BlobStorageContext> blob_context) { |
| return make_scoped_refptr(new CacheStorageCache( |
| @@ -554,7 +558,7 @@ int64 CacheStorageCache::MemoryBackedSize() const { |
| CacheStorageCache::CacheStorageCache( |
| const GURL& origin, |
| const base::FilePath& path, |
| - net::URLRequestContext* request_context, |
| + const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy, |
| base::WeakPtr<storage::BlobStorageContext> blob_context) |
| : origin_(origin), |
| @@ -932,7 +936,8 @@ void CacheStorageCache::PutDidWriteHeaders(scoped_ptr<PutContext> put_context, |
| BlobReader* reader_ptr = reader.get(); |
| // Grab some pointers before passing put_context in Bind. |
| - net::URLRequestContext* request_context = put_context->request_context; |
| + scoped_refptr<net::URLRequestContextGetter> request_context = |
| + put_context->request_context; |
| scoped_ptr<storage::BlobDataHandle> blob_data_handle = |
| put_context->blob_data_handle.Pass(); |