Commit 45bf1493 authored by tzik's avatar tzik Committed by Commit Bot

Hold a reference to ShaderDiskCache while its Init() is called

ShaderDiskCache's reference count used to be 0 at the beginning of Init(), and be incremented
implicitly by base::Bind there. As the reference count is decremented to 0 if CreateCacheBackend
finished immediately and the passed callback is destroyed.
That causes unexpected destruction of the SharedDiskCache instance.

After this CL, the caller of Init() keeps an reference while Init() is running to avoid
destroying the ShaderDiskCache instance.

Bug: 866456
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Iddf9daaf09119aed279ffb81f0af1a74efb9dc54
Reviewed-on: https://chromium-review.googlesource.com/1148090Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577613}
parent 76b816d2
......@@ -468,7 +468,7 @@ scoped_refptr<ShaderDiskCache> ShaderCacheFactory::GetByPath(
if (iter != shader_cache_map_.end())
return iter->second;
ShaderDiskCache* cache = new ShaderDiskCache(this, path);
auto cache = base::WrapRefCounted(new ShaderDiskCache(this, path));
cache->Init();
return cache;
}
......
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