Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3677)

Unified Diff: chrome/browser/extensions/data_deleter.cc

Issue 421193002: Fix ExtensionServiceTest.ClearExtensionData flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use base::DoNothing for empty callbacks Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/data_deleter.h ('k') | chrome/browser/extensions/extension_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/data_deleter.cc
diff --git a/chrome/browser/extensions/data_deleter.cc b/chrome/browser/extensions/data_deleter.cc
index b28e7b29711d73fd763fcd5175fc18b4cdc32e15..6131da831dae1d7faddfce5d532869ee8177ae8c 100644
--- a/chrome/browser/extensions/data_deleter.cc
+++ b/chrome/browser/extensions/data_deleter.cc
@@ -37,7 +37,8 @@ namespace {
// |partition|.
void DeleteOrigin(Profile* profile,
StoragePartition* partition,
- const GURL& origin) {
+ const GURL& origin,
+ const base::Closure& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(profile);
DCHECK(partition);
@@ -56,7 +57,8 @@ void DeleteOrigin(Profile* profile,
~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE,
StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL,
origin,
- profile->GetRequestContextForExtensions());
+ profile->GetRequestContextForExtensions(),
+ callback);
} else {
// We don't need to worry about the media request context because that
// shares the same cookie store as the main request context.
@@ -64,20 +66,24 @@ void DeleteOrigin(Profile* profile,
~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE,
StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL,
origin,
- partition->GetURLRequestContext());
+ partition->GetURLRequestContext(),
+ callback);
}
}
-void OnNeedsToGarbageCollectIsolatedStorage(WeakPtr<ExtensionService> es) {
- if (!es)
- return;
- ExtensionPrefs::Get(es->profile())->SetNeedsStorageGarbageCollection(true);
+void OnNeedsToGarbageCollectIsolatedStorage(WeakPtr<ExtensionService> es,
+ const base::Closure& callback) {
+ if (es)
+ ExtensionPrefs::Get(es->profile())->SetNeedsStorageGarbageCollection(true);
+ callback.Run();
}
} // namespace
// static
-void DataDeleter::StartDeleting(Profile* profile, const Extension* extension) {
+void DataDeleter::StartDeleting(Profile* profile,
+ const Extension* extension,
+ const base::Closure& callback) {
DCHECK(profile);
DCHECK(extension);
@@ -87,7 +93,8 @@ void DataDeleter::StartDeleting(Profile* profile, const Extension* extension) {
util::GetSiteForExtensionId(extension->id(), profile),
base::Bind(
&OnNeedsToGarbageCollectIsolatedStorage,
- ExtensionSystem::Get(profile)->extension_service()->AsWeakPtr()));
+ ExtensionSystem::Get(profile)->extension_service()->AsWeakPtr(),
+ callback));
} else {
GURL launch_web_url_origin(
AppLaunchInfo::GetLaunchWebURL(extension).GetOrigin());
@@ -99,9 +106,12 @@ void DataDeleter::StartDeleting(Profile* profile, const Extension* extension) {
if (extension->is_hosted_app() &&
!profile->GetExtensionSpecialStoragePolicy()->
IsStorageProtected(launch_web_url_origin)) {
- DeleteOrigin(profile, partition, launch_web_url_origin);
+ DeleteOrigin(profile,
+ partition,
+ launch_web_url_origin,
+ base::Bind(&base::DoNothing));
}
- DeleteOrigin(profile, partition, extension->url());
+ DeleteOrigin(profile, partition, extension->url(), callback);
}
#if defined(ENABLE_EXTENSIONS)
« no previous file with comments | « chrome/browser/extensions/data_deleter.h ('k') | chrome/browser/extensions/extension_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698