| Index: content/browser/service_worker/service_worker_context_wrapper.cc
|
| diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9e70e141e5393585d1ebdd710c91350b6f04bbca
|
| --- /dev/null
|
| +++ b/content/browser/service_worker/service_worker_context_wrapper.cc
|
| @@ -0,0 +1,48 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/browser/service_worker/service_worker_context_wrapper.h"
|
| +
|
| +#include "base/files/file_path.h"
|
| +#include "content/browser/service_worker/service_worker_context_core.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| +#include "webkit/browser/quota/quota_manager.h"
|
| +
|
| +namespace content {
|
| +
|
| +ServiceWorkerContextWrapper::ServiceWorkerContextWrapper(
|
| + const base::FilePath& user_data_directory,
|
| + quota::QuotaManagerProxy* quota_manager_proxy)
|
| + : quota_manager_proxy_(quota_manager_proxy),
|
| + user_data_directory_(user_data_directory),
|
| + is_shutdown_(false) {
|
| +}
|
| +
|
| +ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() {
|
| +}
|
| +
|
| +void ServiceWorkerContextWrapper::Shutdown() {
|
| + if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
|
| + BrowserThread::PostTask(
|
| + BrowserThread::IO, FROM_HERE,
|
| + base::Bind(&ServiceWorkerContextWrapper::Shutdown, this));
|
| + return;
|
| + }
|
| + is_shutdown_ = true;
|
| + context_core_.reset();
|
| +}
|
| +
|
| +ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| + if (is_shutdown_)
|
| + return NULL;
|
| + if (!context_core_) {
|
| + context_core_.reset(
|
| + new ServiceWorkerContextCore(
|
| + user_data_directory_, quota_manager_proxy_));
|
| + }
|
| + return context_core_.get();
|
| +}
|
| +
|
| +} // namespace content
|
|
|