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 "chrome/browser/extensions/updater/extension_cache_impl.h" | 5 #include "chrome/browser/extensions/updater/extension_cache_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #endif// Directory where the extensions are cached. | 28 #endif// Directory where the extensions are cached. |
29 | 29 |
30 // Maximum size of local cache on disk. | 30 // Maximum size of local cache on disk. |
31 size_t kMaxCacheSize = 100 * 1024 * 1024; | 31 size_t kMaxCacheSize = 100 * 1024 * 1024; |
32 | 32 |
33 // Maximum age of unused extensions in cache. | 33 // Maximum age of unused extensions in cache. |
34 const int kMaxCacheAgeDays = 30; | 34 const int kMaxCacheAgeDays = 30; |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
| 38 // static |
| 39 ExtensionCacheImpl* ExtensionCacheImpl::GetInstance() { |
| 40 return Singleton<ExtensionCacheImpl>::get(); |
| 41 } |
| 42 |
38 ExtensionCacheImpl::ExtensionCacheImpl() | 43 ExtensionCacheImpl::ExtensionCacheImpl() |
39 : cache_(new LocalExtensionCache(base::FilePath(kLocalCacheDir), | 44 : cache_(new LocalExtensionCache(base::FilePath(kLocalCacheDir), |
40 kMaxCacheSize, | 45 kMaxCacheSize, |
41 base::TimeDelta::FromDays(kMaxCacheAgeDays), | 46 base::TimeDelta::FromDays(kMaxCacheAgeDays), |
42 content::BrowserThread::GetBlockingPool()-> | 47 content::BrowserThread::GetBlockingPool()-> |
43 GetSequencedTaskRunnerWithShutdownBehavior( | 48 GetSequencedTaskRunnerWithShutdownBehavior( |
44 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), | 49 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), |
45 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))), | 50 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))), |
46 weak_ptr_factory_(this) { | 51 weak_ptr_factory_(this) { |
47 notification_registrar_.Add( | 52 notification_registrar_.Add( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 cache_->RemoveExtension(installer->expected_id()); | 131 cache_->RemoveExtension(installer->expected_id()); |
127 break; | 132 break; |
128 } | 133 } |
129 | 134 |
130 default: | 135 default: |
131 NOTREACHED(); | 136 NOTREACHED(); |
132 } | 137 } |
133 } | 138 } |
134 | 139 |
135 } // namespace extensions | 140 } // namespace extensions |
OLD | NEW |