| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 6 |
| 7 #include "base/files/file_path.h" |
| 8 #include "content/browser/service_worker/service_worker_context_core.h" |
| 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "webkit/browser/quota/quota_manager.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 ServiceWorkerContextWrapper::ServiceWorkerContextWrapper() { |
| 15 } |
| 16 |
| 17 ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() { |
| 18 } |
| 19 |
| 20 void ServiceWorkerContextWrapper::Init( |
| 21 const base::FilePath& user_data_directory, |
| 22 quota::QuotaManagerProxy* quota_manager_proxy) { |
| 23 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 24 BrowserThread::PostTask( |
| 25 BrowserThread::IO, FROM_HERE, |
| 26 base::Bind(&ServiceWorkerContextWrapper::Init, this, |
| 27 user_data_directory, |
| 28 make_scoped_refptr(quota_manager_proxy))); |
| 29 return; |
| 30 } |
| 31 DCHECK(!context_core_); |
| 32 context_core_.reset( |
| 33 new ServiceWorkerContextCore( |
| 34 user_data_directory, quota_manager_proxy)); |
| 35 } |
| 36 |
| 37 void ServiceWorkerContextWrapper::Shutdown() { |
| 38 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 39 BrowserThread::PostTask( |
| 40 BrowserThread::IO, FROM_HERE, |
| 41 base::Bind(&ServiceWorkerContextWrapper::Shutdown, this)); |
| 42 return; |
| 43 } |
| 44 context_core_.reset(); |
| 45 } |
| 46 |
| 47 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
| 48 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 49 return context_core_.get(); |
| 50 } |
| 51 |
| 52 } // namespace content |
| OLD | NEW |