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/extension_garbage_collector.h" | 5 #include "chrome/browser/extensions/extension_garbage_collector.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 213 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
214 | 214 |
215 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(context_); | 215 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(context_); |
216 DCHECK(extension_prefs); | 216 DCHECK(extension_prefs); |
217 if (!extension_prefs->NeedsStorageGarbageCollection()) | 217 if (!extension_prefs->NeedsStorageGarbageCollection()) |
218 return; | 218 return; |
219 extension_prefs->SetNeedsStorageGarbageCollection(false); | 219 extension_prefs->SetNeedsStorageGarbageCollection(false); |
220 | 220 |
221 scoped_ptr<base::hash_set<base::FilePath> > active_paths( | 221 scoped_ptr<base::hash_set<base::FilePath> > active_paths( |
222 new base::hash_set<base::FilePath>()); | 222 new base::hash_set<base::FilePath>()); |
223 const ExtensionSet& extensions = | 223 scoped_ptr<ExtensionSet> extensions = |
224 ExtensionRegistry::Get(context_)->enabled_extensions(); | 224 ExtensionRegistry::Get(context_)->GenerateInstalledExtensionsSet(); |
225 for (ExtensionSet::const_iterator iter = extensions.begin(); | 225 for (ExtensionSet::const_iterator iter = extensions->begin(); |
226 iter != extensions.end(); | 226 iter != extensions->end(); |
227 ++iter) { | 227 ++iter) { |
228 if (AppIsolationInfo::HasIsolatedStorage(iter->get())) { | 228 if (AppIsolationInfo::HasIsolatedStorage(iter->get())) { |
229 active_paths->insert( | 229 active_paths->insert( |
230 content::BrowserContext::GetStoragePartitionForSite( | 230 content::BrowserContext::GetStoragePartitionForSite( |
231 context_, util::GetSiteForExtensionId((*iter)->id(), context_)) | 231 context_, util::GetSiteForExtensionId((*iter)->id(), context_)) |
232 ->GetPath()); | 232 ->GetPath()); |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 // The data of ephemeral apps can outlive their cache lifetime. Ensure | 236 // The data of ephemeral apps can outlive their cache lifetime. Ensure |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // accounting. | 271 // accounting. |
272 NOTREACHED(); | 272 NOTREACHED(); |
273 | 273 |
274 // Don't let the count go negative to avoid garbage collecting when | 274 // Don't let the count go negative to avoid garbage collecting when |
275 // an install is actually in progress. | 275 // an install is actually in progress. |
276 crx_installs_in_progress_ = 0; | 276 crx_installs_in_progress_ = 0; |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 } // namespace extensions | 280 } // namespace extensions |
OLD | NEW |