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

Unified Diff: content/browser/gpu/shader_disk_cache.cc

Issue 13730005: Delay signaling Shader cache is available until loading is complete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/shader_disk_cache.cc
diff --git a/content/browser/gpu/shader_disk_cache.cc b/content/browser/gpu/shader_disk_cache.cc
index d1ceef4201df929a60becf99f4c44beb0f65264b..621d7d533fa5371a5607455b9a1371e01377411c 100644
--- a/content/browser/gpu/shader_disk_cache.cc
+++ b/content/browser/gpu/shader_disk_cache.cc
@@ -573,15 +573,8 @@ void ShaderDiskCache::CacheCreatedCallback(int rv) {
LOG(ERROR) << "Shader Cache Creation failed: " << rv;
return;
}
- cache_available_ = true;
-
helper_ = new ShaderDiskReadHelper(AsWeakPtr(), host_id_);
helper_->LoadCache();
-
- if (!available_callback_.is_null()) {
- available_callback_.Run(net::OK);
- available_callback_.Reset();
- }
}
void ShaderDiskCache::EntryComplete(void* entry) {
@@ -593,6 +586,15 @@ void ShaderDiskCache::EntryComplete(void* entry) {
void ShaderDiskCache::ReadComplete() {
helper_ = NULL;
+
+ // The cache is considered available after we have finished reading any
+ // of the old cache values off disk. This prevents a potential race where we
+ // are reading from disk and execute a cache clear at the same time.
+ cache_available_ = true;
+ if (!available_callback_.is_null()) {
+ available_callback_.Run(net::OK);
+ available_callback_.Reset();
+ }
}
int ShaderDiskCache::SetCacheCompleteCallback(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698