Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: content/browser/cache_storage/cache_storage_manager.cc

Issue 1174943004: [CacheStorage] Use URLRequestContextGetter instead of URLRequestContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually pass a getter Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/cache_storage/cache_storage_manager.h" 5 #include "content/browser/cache_storage/cache_storage_manager.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 void CacheStorageManager::MatchAllCaches( 166 void CacheStorageManager::MatchAllCaches(
167 const GURL& origin, 167 const GURL& origin,
168 scoped_ptr<ServiceWorkerFetchRequest> request, 168 scoped_ptr<ServiceWorkerFetchRequest> request,
169 const CacheStorageCache::ResponseCallback& callback) { 169 const CacheStorageCache::ResponseCallback& callback) {
170 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); 170 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin);
171 171
172 cache_storage->MatchAllCaches(request.Pass(), callback); 172 cache_storage->MatchAllCaches(request.Pass(), callback);
173 } 173 }
174 174
175 void CacheStorageManager::SetBlobParametersForCache( 175 void CacheStorageManager::SetBlobParametersForCache(
176 net::URLRequestContext* request_context, 176 const scoped_refptr<net::URLRequestContextGetter>& request_context,
177 base::WeakPtr<storage::BlobStorageContext> blob_storage_context) { 177 base::WeakPtr<storage::BlobStorageContext> blob_storage_context) {
178 DCHECK_CURRENTLY_ON(BrowserThread::IO); 178 DCHECK_CURRENTLY_ON(BrowserThread::IO);
179 DCHECK(cache_storage_map_.empty()); 179 DCHECK(cache_storage_map_.empty());
180 DCHECK(!request_context_ || request_context_ == request_context); 180 DCHECK(!request_context_ || request_context_.get() == request_context.get());
181 DCHECK(!blob_context_ || blob_context_.get() == blob_storage_context.get()); 181 DCHECK(!blob_context_ || blob_context_.get() == blob_storage_context.get());
182 request_context_ = request_context; 182 request_context_ = request_context;
183 blob_context_ = blob_storage_context; 183 blob_context_ = blob_storage_context;
184 } 184 }
185 185
186 void CacheStorageManager::GetOriginUsage( 186 void CacheStorageManager::GetOriginUsage(
187 const GURL& origin_url, 187 const GURL& origin_url,
188 const storage::QuotaClient::GetUsageCallback& callback) { 188 const storage::QuotaClient::GetUsageCallback& callback) {
189 DCHECK_CURRENTLY_ON(BrowserThread::IO); 189 DCHECK_CURRENTLY_ON(BrowserThread::IO);
190 190
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 base::Bind(&DeleteOriginDidDeleteDir, callback)); 285 base::Bind(&DeleteOriginDidDeleteDir, callback));
286 } 286 }
287 287
288 CacheStorageManager::CacheStorageManager( 288 CacheStorageManager::CacheStorageManager(
289 const base::FilePath& path, 289 const base::FilePath& path,
290 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, 290 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner,
291 const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy) 291 const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy)
292 : root_path_(path), 292 : root_path_(path),
293 cache_task_runner_(cache_task_runner), 293 cache_task_runner_(cache_task_runner),
294 quota_manager_proxy_(quota_manager_proxy), 294 quota_manager_proxy_(quota_manager_proxy),
295 request_context_(NULL),
296 weak_ptr_factory_(this) { 295 weak_ptr_factory_(this) {
297 if (quota_manager_proxy_.get()) { 296 if (quota_manager_proxy_.get()) {
298 quota_manager_proxy_->RegisterClient( 297 quota_manager_proxy_->RegisterClient(
299 new CacheStorageQuotaClient(weak_ptr_factory_.GetWeakPtr())); 298 new CacheStorageQuotaClient(weak_ptr_factory_.GetWeakPtr()));
300 } 299 }
301 } 300 }
302 301
303 CacheStorage* CacheStorageManager::FindOrCreateCacheStorage( 302 CacheStorage* CacheStorageManager::FindOrCreateCacheStorage(
304 const GURL& origin) { 303 const GURL& origin) {
305 DCHECK_CURRENTLY_ON(BrowserThread::IO); 304 DCHECK_CURRENTLY_ON(BrowserThread::IO);
306 DCHECK(request_context_); 305 DCHECK(request_context_.get());
mmenke 2015/06/10 17:00:31 I don't think .get is needed to coerce refptrs to
jkarlin 2015/06/10 18:26:03 Done.
307 CacheStorageMap::const_iterator it = cache_storage_map_.find(origin); 306 CacheStorageMap::const_iterator it = cache_storage_map_.find(origin);
308 if (it == cache_storage_map_.end()) { 307 if (it == cache_storage_map_.end()) {
309 MigrateOrigin(origin); 308 MigrateOrigin(origin);
310 CacheStorage* cache_storage = new CacheStorage( 309 CacheStorage* cache_storage = new CacheStorage(
311 ConstructOriginPath(root_path_, origin), IsMemoryBacked(), 310 ConstructOriginPath(root_path_, origin), IsMemoryBacked(),
312 cache_task_runner_.get(), request_context_, quota_manager_proxy_, 311 cache_task_runner_.get(), request_context_, quota_manager_proxy_,
313 blob_context_, origin); 312 blob_context_, origin);
314 // The map owns fetch_stores. 313 // The map owns fetch_stores.
315 cache_storage_map_.insert(std::make_pair(origin, cache_storage)); 314 cache_storage_map_.insert(std::make_pair(origin, cache_storage));
316 return cache_storage; 315 return cache_storage;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 const base::FilePath& old_path, 354 const base::FilePath& old_path,
356 const base::FilePath& new_path) { 355 const base::FilePath& new_path) {
357 if (base::PathExists(old_path)) { 356 if (base::PathExists(old_path)) {
358 if (!base::PathExists(new_path)) 357 if (!base::PathExists(new_path))
359 base::Move(old_path, new_path); 358 base::Move(old_path, new_path);
360 base::DeleteFile(old_path, /*recursive*/ true); 359 base::DeleteFile(old_path, /*recursive*/ true);
361 } 360 }
362 } 361 }
363 362
364 } // namespace content 363 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698