| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/service_worker/service_worker_context_wrapper.h" | 5 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 new ObserverListThreadSafe<ServiceWorkerContextObserver>()), | 27 new ObserverListThreadSafe<ServiceWorkerContextObserver>()), |
| 28 process_manager_(new ServiceWorkerProcessManager(browser_context)), | 28 process_manager_(new ServiceWorkerProcessManager(browser_context)), |
| 29 is_incognito_(false) { | 29 is_incognito_(false) { |
| 30 } | 30 } |
| 31 | 31 |
| 32 ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() { | 32 ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() { |
| 33 } | 33 } |
| 34 | 34 |
| 35 void ServiceWorkerContextWrapper::Init( | 35 void ServiceWorkerContextWrapper::Init( |
| 36 const base::FilePath& user_data_directory, | 36 const base::FilePath& user_data_directory, |
| 37 quota::QuotaManagerProxy* quota_manager_proxy) { | 37 storage::QuotaManagerProxy* quota_manager_proxy) { |
| 38 is_incognito_ = user_data_directory.empty(); | 38 is_incognito_ = user_data_directory.empty(); |
| 39 scoped_refptr<base::SequencedTaskRunner> database_task_runner = | 39 scoped_refptr<base::SequencedTaskRunner> database_task_runner = |
| 40 BrowserThread::GetBlockingPool()-> | 40 BrowserThread::GetBlockingPool()-> |
| 41 GetSequencedTaskRunnerWithShutdownBehavior( | 41 GetSequencedTaskRunnerWithShutdownBehavior( |
| 42 BrowserThread::GetBlockingPool()->GetSequenceToken(), | 42 BrowserThread::GetBlockingPool()->GetSequenceToken(), |
| 43 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 43 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| 44 scoped_refptr<base::SingleThreadTaskRunner> disk_cache_thread = | 44 scoped_refptr<base::SingleThreadTaskRunner> disk_cache_thread = |
| 45 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE); | 45 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE); |
| 46 scoped_refptr<base::SequencedTaskRunner> cache_task_runner = | 46 scoped_refptr<base::SequencedTaskRunner> cache_task_runner = |
| 47 BrowserThread::GetBlockingPool() | 47 BrowserThread::GetBlockingPool() |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 request_context->GetURLRequestContext(), | 236 request_context->GetURLRequestContext(), |
| 237 blob_storage_context->context()->AsWeakPtr()); | 237 blob_storage_context->context()->AsWeakPtr()); |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 void ServiceWorkerContextWrapper::InitInternal( | 241 void ServiceWorkerContextWrapper::InitInternal( |
| 242 const base::FilePath& user_data_directory, | 242 const base::FilePath& user_data_directory, |
| 243 const scoped_refptr<base::SequencedTaskRunner>& stores_task_runner, | 243 const scoped_refptr<base::SequencedTaskRunner>& stores_task_runner, |
| 244 const scoped_refptr<base::SequencedTaskRunner>& database_task_runner, | 244 const scoped_refptr<base::SequencedTaskRunner>& database_task_runner, |
| 245 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, | 245 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, |
| 246 quota::QuotaManagerProxy* quota_manager_proxy) { | 246 storage::QuotaManagerProxy* quota_manager_proxy) { |
| 247 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 247 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 248 BrowserThread::PostTask( | 248 BrowserThread::PostTask( |
| 249 BrowserThread::IO, | 249 BrowserThread::IO, |
| 250 FROM_HERE, | 250 FROM_HERE, |
| 251 base::Bind(&ServiceWorkerContextWrapper::InitInternal, | 251 base::Bind(&ServiceWorkerContextWrapper::InitInternal, |
| 252 this, | 252 this, |
| 253 user_data_directory, | 253 user_data_directory, |
| 254 stores_task_runner, | 254 stores_task_runner, |
| 255 database_task_runner, | 255 database_task_runner, |
| 256 disk_cache_thread, | 256 disk_cache_thread, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 277 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 277 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 278 if (status != SERVICE_WORKER_OK) { | 278 if (status != SERVICE_WORKER_OK) { |
| 279 context_core_.reset(); | 279 context_core_.reset(); |
| 280 return; | 280 return; |
| 281 } | 281 } |
| 282 context_core_.reset(new ServiceWorkerContextCore(context_core_.get(), this)); | 282 context_core_.reset(new ServiceWorkerContextCore(context_core_.get(), this)); |
| 283 DVLOG(1) << "Restarted ServiceWorkerContextCore successfully."; | 283 DVLOG(1) << "Restarted ServiceWorkerContextCore successfully."; |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace content | 286 } // namespace content |
| OLD | NEW |