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 23 matching lines...) Expand all Loading... |
34 const int kMaxCacheAgeDays = 30; | 34 const int kMaxCacheAgeDays = 30; |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 // static | 38 // static |
39 ExtensionCacheImpl* ExtensionCacheImpl::GetInstance() { | 39 ExtensionCacheImpl* ExtensionCacheImpl::GetInstance() { |
40 return Singleton<ExtensionCacheImpl>::get(); | 40 return Singleton<ExtensionCacheImpl>::get(); |
41 } | 41 } |
42 | 42 |
43 ExtensionCacheImpl::ExtensionCacheImpl() | 43 ExtensionCacheImpl::ExtensionCacheImpl() |
44 : weak_ptr_factory_(this), | 44 : cache_(new LocalExtensionCache(base::FilePath(kLocalCacheDir), |
45 cache_(new LocalExtensionCache(base::FilePath(kLocalCacheDir), | |
46 kMaxCacheSize, | 45 kMaxCacheSize, |
47 base::TimeDelta::FromDays(kMaxCacheAgeDays), | 46 base::TimeDelta::FromDays(kMaxCacheAgeDays), |
48 content::BrowserThread::GetBlockingPool()-> | 47 content::BrowserThread::GetBlockingPool()-> |
49 GetSequencedTaskRunnerWithShutdownBehavior( | 48 GetSequencedTaskRunnerWithShutdownBehavior( |
50 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), | 49 content::BrowserThread::GetBlockingPool()->GetSequenceToken(), |
51 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))) { | 50 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))), |
| 51 weak_ptr_factory_(this) { |
52 notification_registrar_.Add( | 52 notification_registrar_.Add( |
53 this, | 53 this, |
54 extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 54 extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
55 content::NotificationService::AllBrowserContextsAndSources()); | 55 content::NotificationService::AllBrowserContextsAndSources()); |
56 cache_->Init(true, base::Bind(&ExtensionCacheImpl::OnCacheInitialized, | 56 cache_->Init(true, base::Bind(&ExtensionCacheImpl::OnCacheInitialized, |
57 weak_ptr_factory_.GetWeakPtr())); | 57 weak_ptr_factory_.GetWeakPtr())); |
58 } | 58 } |
59 | 59 |
60 ExtensionCacheImpl::~ExtensionCacheImpl() { | 60 ExtensionCacheImpl::~ExtensionCacheImpl() { |
61 } | 61 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 cache_->RemoveExtension(installer->expected_id()); | 131 cache_->RemoveExtension(installer->expected_id()); |
132 break; | 132 break; |
133 } | 133 } |
134 | 134 |
135 default: | 135 default: |
136 NOTREACHED(); | 136 NOTREACHED(); |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 } // namespace extensions | 140 } // namespace extensions |
OLD | NEW |