| 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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
| 10 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
| 11 #include "content/browser/service_worker/service_worker_context_observer.h" | 11 #include "content/browser/service_worker/service_worker_context_observer.h" |
| 12 #include "content/browser/service_worker/service_worker_process_manager.h" | 12 #include "content/browser/service_worker/service_worker_process_manager.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "webkit/browser/quota/quota_manager_proxy.h" | 14 #include "webkit/browser/quota/quota_manager_proxy.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 ServiceWorkerContextWrapper::ServiceWorkerContextWrapper( | 18 ServiceWorkerContextWrapper::ServiceWorkerContextWrapper( |
| 19 BrowserContext* browser_context) | 19 BrowserContext* browser_context) |
| 20 : observer_list_( | 20 : observer_list_( |
| 21 new ObserverListThreadSafe<ServiceWorkerContextObserver>()), | 21 new ObserverListThreadSafe<ServiceWorkerContextObserver>()), |
| 22 process_manager_(new ServiceWorkerProcessManager(browser_context)) { | 22 process_manager_(new ServiceWorkerProcessManager(browser_context)), |
| 23 is_incognito_(false) { |
| 23 } | 24 } |
| 24 | 25 |
| 25 ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() { | 26 ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() { |
| 26 } | 27 } |
| 27 | 28 |
| 28 void ServiceWorkerContextWrapper::Init( | 29 void ServiceWorkerContextWrapper::Init( |
| 29 const base::FilePath& user_data_directory, | 30 const base::FilePath& user_data_directory, |
| 30 quota::QuotaManagerProxy* quota_manager_proxy) { | 31 quota::QuotaManagerProxy* quota_manager_proxy) { |
| 32 is_incognito_ = user_data_directory.empty(); |
| 31 scoped_refptr<base::SequencedTaskRunner> database_task_runner = | 33 scoped_refptr<base::SequencedTaskRunner> database_task_runner = |
| 32 BrowserThread::GetBlockingPool()-> | 34 BrowserThread::GetBlockingPool()-> |
| 33 GetSequencedTaskRunnerWithShutdownBehavior( | 35 GetSequencedTaskRunnerWithShutdownBehavior( |
| 34 BrowserThread::GetBlockingPool()->GetSequenceToken(), | 36 BrowserThread::GetBlockingPool()->GetSequenceToken(), |
| 35 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 37 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| 36 scoped_refptr<base::MessageLoopProxy> disk_cache_thread = | 38 scoped_refptr<base::MessageLoopProxy> disk_cache_thread = |
| 37 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE); | 39 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE); |
| 38 InitInternal(user_data_directory, database_task_runner, | 40 InitInternal(user_data_directory, database_task_runner, |
| 39 disk_cache_thread, quota_manager_proxy); | 41 disk_cache_thread, quota_manager_proxy); |
| 40 } | 42 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 177 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 176 if (status != SERVICE_WORKER_OK) { | 178 if (status != SERVICE_WORKER_OK) { |
| 177 context_core_.reset(); | 179 context_core_.reset(); |
| 178 return; | 180 return; |
| 179 } | 181 } |
| 180 context_core_.reset(new ServiceWorkerContextCore(context_core_.get(), this)); | 182 context_core_.reset(new ServiceWorkerContextCore(context_core_.get(), this)); |
| 181 DVLOG(1) << "Restarted ServiceWorkerContextCore successfully."; | 183 DVLOG(1) << "Restarted ServiceWorkerContextCore successfully."; |
| 182 } | 184 } |
| 183 | 185 |
| 184 } // namespace content | 186 } // namespace content |
| OLD | NEW |