Commit 996948e1 authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

quota: Fix type confusion in QuotaManagedDataDeletionHelper.

StoragePartitionImpl::QuotaManagedDataDeletionHelper receives the set of
storage backends whose storage will be deleted using a
StoragePartitionImpl-specific remove_mask, which is a uint32_t. It is
responsible for converting this to a QuotaManager-specific
quota_client_mask, which is an int.

The conversion is done correctly when calling
QuotaManager::DeleteOriginData(), but is skipped when calling
QuotaManaegr::PerformStorageCleanup().

This CL ensures that the conversion is done consistently when
transitioning into QuotaManager. This problem was discovered while
moving the Quota subsystem to the Storage Service. The problem is fixed
in a small independent CL to take advantage of Canary's ability to catch
unexpected issues.

Bug: 1016065
Change-Id: I165e2033d73b5d3458c50ed5a58117130daf9db0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186178Reviewed-by: default avatarJarryd Goodman <jarrydg@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766467}
parent c61d04c3
...@@ -270,9 +270,9 @@ void OnQuotaManagedOriginDeleted(const url::Origin& origin, ...@@ -270,9 +270,9 @@ void OnQuotaManagedOriginDeleted(const url::Origin& origin,
void PerformQuotaManagerStorageCleanup( void PerformQuotaManagerStorageCleanup(
const scoped_refptr<storage::QuotaManager>& quota_manager, const scoped_refptr<storage::QuotaManager>& quota_manager,
blink::mojom::StorageType quota_storage_type, blink::mojom::StorageType quota_storage_type,
uint32_t remove_mask, int quota_client_mask,
base::OnceClosure callback) { base::OnceClosure callback) {
quota_manager->PerformStorageCleanup(quota_storage_type, remove_mask, quota_manager->PerformStorageCleanup(quota_storage_type, quota_client_mask,
std::move(callback)); std::move(callback));
} }
...@@ -2186,13 +2186,16 @@ void StoragePartitionImpl::QuotaManagedDataDeletionHelper:: ...@@ -2186,13 +2186,16 @@ void StoragePartitionImpl::QuotaManagedDataDeletionHelper::
return; return;
} }
int quota_client_mask =
StoragePartitionImpl::GenerateQuotaClientMask(remove_mask_);
// The logic below (via CheckQuotaManagedDataDeletionStatus) only // The logic below (via CheckQuotaManagedDataDeletionStatus) only
// invokes the callback when all processing is complete. // invokes the callback when all processing is complete.
base::RepeatingClosure done_callback = base::AdaptCallbackForRepeating( base::RepeatingClosure done_callback = base::AdaptCallbackForRepeating(
perform_storage_cleanup perform_storage_cleanup
? base::BindOnce(&PerformQuotaManagerStorageCleanup, ? base::BindOnce(&PerformQuotaManagerStorageCleanup,
base::WrapRefCounted(quota_manager), base::WrapRefCounted(quota_manager),
quota_storage_type, remove_mask_, quota_storage_type, quota_client_mask,
std::move(callback)) std::move(callback))
: std::move(callback)); : std::move(callback));
...@@ -2210,8 +2213,7 @@ void StoragePartitionImpl::QuotaManagedDataDeletionHelper:: ...@@ -2210,8 +2213,7 @@ void StoragePartitionImpl::QuotaManagedDataDeletionHelper::
(*deletion_task_count)++; (*deletion_task_count)++;
quota_manager->DeleteOriginData( quota_manager->DeleteOriginData(
origin, quota_storage_type, origin, quota_storage_type, quota_client_mask,
StoragePartitionImpl::GenerateQuotaClientMask(remove_mask_),
base::BindOnce(&OnQuotaManagedOriginDeleted, origin, quota_storage_type, base::BindOnce(&OnQuotaManagedOriginDeleted, origin, quota_storage_type,
deletion_task_count, done_callback)); deletion_task_count, done_callback));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment