| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 iter != extensions->end(); | 220 iter != extensions->end(); |
| 221 ++iter) { | 221 ++iter) { |
| 222 if (AppIsolationInfo::HasIsolatedStorage(iter->get())) { | 222 if (AppIsolationInfo::HasIsolatedStorage(iter->get())) { |
| 223 active_paths->insert( | 223 active_paths->insert( |
| 224 content::BrowserContext::GetStoragePartitionForSite( | 224 content::BrowserContext::GetStoragePartitionForSite( |
| 225 context_, util::GetSiteForExtensionId((*iter)->id(), context_)) | 225 context_, util::GetSiteForExtensionId((*iter)->id(), context_)) |
| 226 ->GetPath()); | 226 ->GetPath()); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 // The data of ephemeral apps can outlive their cache lifetime. Ensure | |
| 231 // they are not garbage collected. | |
| 232 scoped_ptr<ExtensionPrefs::ExtensionsInfo> evicted_apps_info( | |
| 233 extension_prefs->GetEvictedEphemeralAppsInfo()); | |
| 234 for (size_t i = 0; i < evicted_apps_info->size(); ++i) { | |
| 235 ExtensionInfo* info = evicted_apps_info->at(i).get(); | |
| 236 if (util::HasIsolatedStorage(*info)) { | |
| 237 active_paths->insert(content::BrowserContext::GetStoragePartitionForSite( | |
| 238 context_, | |
| 239 util::GetSiteForExtensionId( | |
| 240 info->extension_id, context_))->GetPath()); | |
| 241 } | |
| 242 } | |
| 243 | |
| 244 ExtensionService* service = | 230 ExtensionService* service = |
| 245 ExtensionSystem::Get(context_)->extension_service(); | 231 ExtensionSystem::Get(context_)->extension_service(); |
| 246 service->OnGarbageCollectIsolatedStorageStart(); | 232 service->OnGarbageCollectIsolatedStorageStart(); |
| 247 content::BrowserContext::GarbageCollectStoragePartitions( | 233 content::BrowserContext::GarbageCollectStoragePartitions( |
| 248 context_, | 234 context_, |
| 249 active_paths.Pass(), | 235 active_paths.Pass(), |
| 250 base::Bind(&ExtensionService::OnGarbageCollectIsolatedStorageFinished, | 236 base::Bind(&ExtensionService::OnGarbageCollectIsolatedStorageFinished, |
| 251 service->AsWeakPtr())); | 237 service->AsWeakPtr())); |
| 252 } | 238 } |
| 253 | 239 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 265 // accounting. | 251 // accounting. |
| 266 NOTREACHED(); | 252 NOTREACHED(); |
| 267 | 253 |
| 268 // Don't let the count go negative to avoid garbage collecting when | 254 // Don't let the count go negative to avoid garbage collecting when |
| 269 // an install is actually in progress. | 255 // an install is actually in progress. |
| 270 crx_installs_in_progress_ = 0; | 256 crx_installs_in_progress_ = 0; |
| 271 } | 257 } |
| 272 } | 258 } |
| 273 | 259 |
| 274 } // namespace extensions | 260 } // namespace extensions |
| OLD | NEW |