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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/files/file_enumerator.h" | 11 #include "base/files/file_enumerator.h" |
11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
12 #include "base/location.h" | 13 #include "base/location.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 content::BrowserContext::GetStoragePartitionForSite( | 230 content::BrowserContext::GetStoragePartitionForSite( |
230 context_, util::GetSiteForExtensionId((*iter)->id(), context_)) | 231 context_, util::GetSiteForExtensionId((*iter)->id(), context_)) |
231 ->GetPath()); | 232 ->GetPath()); |
232 } | 233 } |
233 } | 234 } |
234 | 235 |
235 ExtensionService* service = | 236 ExtensionService* service = |
236 ExtensionSystem::Get(context_)->extension_service(); | 237 ExtensionSystem::Get(context_)->extension_service(); |
237 service->OnGarbageCollectIsolatedStorageStart(); | 238 service->OnGarbageCollectIsolatedStorageStart(); |
238 content::BrowserContext::GarbageCollectStoragePartitions( | 239 content::BrowserContext::GarbageCollectStoragePartitions( |
239 context_, | 240 context_, std::move(active_paths), |
240 active_paths.Pass(), | |
241 base::Bind(&ExtensionService::OnGarbageCollectIsolatedStorageFinished, | 241 base::Bind(&ExtensionService::OnGarbageCollectIsolatedStorageFinished, |
242 service->AsWeakPtr())); | 242 service->AsWeakPtr())); |
243 } | 243 } |
244 | 244 |
245 void ExtensionGarbageCollector::OnBeginCrxInstall( | 245 void ExtensionGarbageCollector::OnBeginCrxInstall( |
246 const std::string& extension_id) { | 246 const std::string& extension_id) { |
247 crx_installs_in_progress_++; | 247 crx_installs_in_progress_++; |
248 } | 248 } |
249 | 249 |
250 void ExtensionGarbageCollector::OnFinishCrxInstall( | 250 void ExtensionGarbageCollector::OnFinishCrxInstall( |
251 const std::string& extension_id, | 251 const std::string& extension_id, |
252 bool success) { | 252 bool success) { |
253 crx_installs_in_progress_--; | 253 crx_installs_in_progress_--; |
254 if (crx_installs_in_progress_ < 0) { | 254 if (crx_installs_in_progress_ < 0) { |
255 // This can only happen if there is a mismatch in our begin/finish | 255 // This can only happen if there is a mismatch in our begin/finish |
256 // accounting. | 256 // accounting. |
257 NOTREACHED(); | 257 NOTREACHED(); |
258 | 258 |
259 // Don't let the count go negative to avoid garbage collecting when | 259 // Don't let the count go negative to avoid garbage collecting when |
260 // an install is actually in progress. | 260 // an install is actually in progress. |
261 crx_installs_in_progress_ = 0; | 261 crx_installs_in_progress_ = 0; |
262 } | 262 } |
263 } | 263 } |
264 | 264 |
265 } // namespace extensions | 265 } // namespace extensions |
OLD | NEW |