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 | |
43 ExtensionCacheImpl::ExtensionCacheImpl() | 38 ExtensionCacheImpl::ExtensionCacheImpl() |
44 : cache_(new LocalExtensionCache(base::FilePath(kLocalCacheDir), | 39 : cache_(new LocalExtensionCache(base::FilePath(kLocalCacheDir), |
45 kMaxCacheSize, | 40 kMaxCacheSize, |
46 base::TimeDelta::FromDays(kMaxCacheAgeDays), | 41 base::TimeDelta::FromDays(kMaxCacheAgeDays), |
47 content::BrowserThread::GetBlockingPool()-> | 42 content::BrowserThread::GetBlockingPool()-> |
48 GetSequencedTaskRunnerWithShutdownBehavior( | 43 GetSequencedTaskRunnerWithShutdownBehavior( |
49 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), | 44 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), |
50 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))), | 45 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))), |
51 weak_ptr_factory_(this) { | 46 weak_ptr_factory_(this) { |
52 notification_registrar_.Add( | 47 notification_registrar_.Add( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 cache_->RemoveExtension(installer->expected_id()); | 126 cache_->RemoveExtension(installer->expected_id()); |
132 break; | 127 break; |
133 } | 128 } |
134 | 129 |
135 default: | 130 default: |
136 NOTREACHED(); | 131 NOTREACHED(); |
137 } | 132 } |
138 } | 133 } |
139 | 134 |
140 } // namespace extensions | 135 } // namespace extensions |
OLD | NEW |