Commit 077f1da1 authored by Rohit Agarwal's avatar Rohit Agarwal Committed by Commit Bot

Delete shader cache after writing to remove mask.

The deletion of data from StoragePartition is  triggered before
REMOVE_DATA_MASK_SHADER_CACHE gets written to the deletion mask which
led to not deletion of shader cache.

The fix was to write to the remove mask before deletion is called.

Bug: 960783
Change-Id: I023462d6d419f369286380751746814dbef404a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819438
Commit-Queue: Rohit Agarwal <roagarwal@chromium.org>
Reviewed-by: default avatarJoshua Bell <jsbell@chromium.org>
Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700127}
parent f15fdded
......@@ -360,7 +360,12 @@ void BrowsingDataRemoverImpl::RemoveImpl(
storage_partition_remove_mask |=
StoragePartition::REMOVE_DATA_MASK_BACKGROUND_FETCH;
}
if (remove_mask & DATA_TYPE_CACHE) {
// Tell the shader disk cache to clear.
base::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache"));
storage_partition_remove_mask |=
StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE;
}
// Content Decryption Modules used by Encrypted Media store licenses in a
// private filesystem. These are different than content licenses used by
// Flash (which are deleted father down in this method).
......@@ -447,11 +452,6 @@ void BrowsingDataRemoverImpl::RemoveImpl(
// Clears the PrefetchedSignedExchangeCache of all RenderFrameHostImpls.
RenderFrameHostImpl::ClearAllPrefetchedSignedExchangeCache();
// Tell the shader disk cache to clear.
base::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache"));
storage_partition_remove_mask |=
StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE;
}
#if BUILDFLAG(ENABLE_REPORTING)
......
......@@ -1215,6 +1215,14 @@ TEST_F(BrowsingDataRemoverImplTest, RemoveCodeCache) {
EXPECT_TRUE(removal_data.remove_code_cache);
}
TEST_F(BrowsingDataRemoverImplTest, RemoveShaderCache) {
BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(),
BrowsingDataRemover::DATA_TYPE_CACHE, false);
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE);
}
class MultipleTasksObserver {
public:
// A simple implementation of BrowsingDataRemover::Observer.
......
......@@ -172,7 +172,17 @@ void ClearShaderCacheOnIOThread(const base::FilePath& path,
const base::Time end,
base::OnceClosure callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
GetShaderCacheFactorySingleton()->ClearByPath(
gpu::ShaderCacheFactory* shader_cache_factory =
GetShaderCacheFactorySingleton();
// May be null in tests where it is difficult to plumb through a test storage
// partition.
if (!shader_cache_factory) {
std::move(callback).Run();
return;
}
shader_cache_factory->ClearByPath(
path, begin, end,
base::BindOnce(&ClearedShaderCache, std::move(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