| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_cache.h" | 5 #include "content/browser/service_worker/service_worker_cache.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 ServiceWorkerCache* ServiceWorkerCache::CreateMemoryCache( | 14 scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreateMemoryCache( |
| 15 const std::string& name) { | 15 const std::string& name) { |
| 16 return new ServiceWorkerCache(base::FilePath(), name); | 16 return make_scoped_ptr(new ServiceWorkerCache(base::FilePath(), name)); |
| 17 } | 17 } |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 ServiceWorkerCache* ServiceWorkerCache::CreatePersistentCache( | 20 scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreatePersistentCache( |
| 21 const base::FilePath& path, | 21 const base::FilePath& path, |
| 22 const std::string& name) { | 22 const std::string& name) { |
| 23 return new ServiceWorkerCache(path, name); | 23 return make_scoped_ptr(new ServiceWorkerCache(path, name)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void ServiceWorkerCache::CreateBackend( | 26 void ServiceWorkerCache::CreateBackend( |
| 27 const base::Callback<void(bool)>& callback) { | 27 const base::Callback<void(bool)>& callback) { |
| 28 callback.Run(true); | 28 callback.Run(true); |
| 29 } | 29 } |
| 30 | 30 |
| 31 base::WeakPtr<ServiceWorkerCache> ServiceWorkerCache::AsWeakPtr() { |
| 32 return weak_ptr_factory_.GetWeakPtr(); |
| 33 } |
| 34 |
| 31 ServiceWorkerCache::ServiceWorkerCache(const base::FilePath& path, | 35 ServiceWorkerCache::ServiceWorkerCache(const base::FilePath& path, |
| 32 const std::string& name) | 36 const std::string& name) |
| 33 : path_(path), name_(name), id_(0) { | 37 : path_(path), name_(name), id_(0), weak_ptr_factory_(this) { |
| 34 } | 38 } |
| 35 | 39 |
| 36 ServiceWorkerCache::~ServiceWorkerCache() { | 40 ServiceWorkerCache::~ServiceWorkerCache() { |
| 37 } | 41 } |
| 38 | 42 |
| 39 } // namespace content | 43 } // namespace content |
| OLD | NEW |