| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_context_impl.h" | 5 #include "content/browser/cache_storage/cache_storage_context_impl.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" | 
| 9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" | 
| 10 #include "content/browser/cache_storage/cache_storage_manager.h" | 10 #include "content/browser/cache_storage/cache_storage_manager.h" | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 29 void CacheStorageContextImpl::Init( | 29 void CacheStorageContextImpl::Init( | 
| 30     const base::FilePath& user_data_directory, | 30     const base::FilePath& user_data_directory, | 
| 31     storage::QuotaManagerProxy* quota_manager_proxy, | 31     storage::QuotaManagerProxy* quota_manager_proxy, | 
| 32     storage::SpecialStoragePolicy* special_storage_policy) { | 32     storage::SpecialStoragePolicy* special_storage_policy) { | 
| 33   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 33   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 
| 34 | 34 | 
| 35   is_incognito_ = user_data_directory.empty(); | 35   is_incognito_ = user_data_directory.empty(); | 
| 36   base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 36   base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 
| 37   scoped_refptr<base::SequencedTaskRunner> cache_task_runner = | 37   scoped_refptr<base::SequencedTaskRunner> cache_task_runner = | 
| 38       pool->GetSequencedTaskRunnerWithShutdownBehavior( | 38       pool->GetSequencedTaskRunnerWithShutdownBehavior( | 
| 39           BrowserThread::GetBlockingPool()->GetSequenceToken(), | 39           base::SequencedWorkerPool::GetSequenceToken(), | 
| 40           base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 40           base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 
| 41 | 41 | 
| 42   // This thread-hopping antipattern is needed here for some unit tests, where | 42   // This thread-hopping antipattern is needed here for some unit tests, where | 
| 43   // browser threads are collapsed the quota manager is initialized before the | 43   // browser threads are collapsed the quota manager is initialized before the | 
| 44   // posted task can register the quota client. | 44   // posted task can register the quota client. | 
| 45   // TODO: Fix the tests to let the quota manager initialize normally. | 45   // TODO: Fix the tests to let the quota manager initialize normally. | 
| 46   if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 46   if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 
| 47     CreateCacheStorageManager(user_data_directory, cache_task_runner, | 47     CreateCacheStorageManager(user_data_directory, cache_task_runner, | 
| 48                               quota_manager_proxy, special_storage_policy); | 48                               quota_manager_proxy, special_storage_policy); | 
| 49     return; | 49     return; | 
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 114                                   make_scoped_refptr(quota_manager_proxy)); | 114                                   make_scoped_refptr(quota_manager_proxy)); | 
| 115 } | 115 } | 
| 116 | 116 | 
| 117 void CacheStorageContextImpl::ShutdownOnIO() { | 117 void CacheStorageContextImpl::ShutdownOnIO() { | 
| 118   DCHECK_CURRENTLY_ON(BrowserThread::IO); | 118   DCHECK_CURRENTLY_ON(BrowserThread::IO); | 
| 119 | 119 | 
| 120   cache_manager_.reset(); | 120   cache_manager_.reset(); | 
| 121 } | 121 } | 
| 122 | 122 | 
| 123 }  // namespace content | 123 }  // namespace content | 
| OLD | NEW | 
|---|