Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: content/browser/service_worker/service_worker_context_wrapper.cc

Issue 61023005: service worker scaffolding (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 const base::FilePath& user_data_directory,
16 quota::QuotaManagerProxy* quota_manager_proxy)
17 : quota_manager_proxy_(quota_manager_proxy),
18 user_data_directory_(user_data_directory),
19 is_shutdown_(false) {
20 }
21
22 ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() {
23 }
24
25 void ServiceWorkerContextWrapper::Shutdown() {
26 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
27 BrowserThread::PostTask(
28 BrowserThread::IO, FROM_HERE,
29 base::Bind(&ServiceWorkerContextWrapper::Shutdown, this));
30 return;
31 }
32 is_shutdown_ = true;
33 context_core_.reset();
34 }
35
36 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() {
37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
38 if (is_shutdown_)
39 return NULL;
40 if (!context_core_) {
41 context_core_.reset(
42 new ServiceWorkerContextCore(
43 user_data_directory_, quota_manager_proxy_));
44 }
45 return context_core_.get();
46 }
47
48 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698