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

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

Issue 2744363002: Clear shader disk cache after glProgramBinary failure. (Closed)
Patch Set: Remove singleton and clean up init Created 3 years, 9 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 | « content/browser/gpu/gpu_process_host.h ('k') | content/gpu/gpu_child_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/gpu_process_host.cc
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 33dc88f7ca9cff248d0d8a66fa1fa49fb5db53f8..b915196971d5b23457f38a56dfd8bf1956254e91 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -636,9 +636,9 @@ bool GpuProcessHost::Init() {
->GetAssociatedInterfaceSupport()
->GetRemoteAssociatedInterface(&gpu_main_ptr_);
ui::mojom::GpuServiceRequest request(&gpu_service_ptr_);
- gpu_main_ptr_->CreateGpuService(std::move(request),
- gpu_host_binding_.CreateInterfacePtrAndBind(),
- gpu_preferences);
+ gpu_main_ptr_->CreateGpuService(
+ std::move(request), gpu_host_binding_.CreateInterfacePtrAndBind(),
+ gpu_preferences, activity_flags_.CloneHandle());
#if defined(USE_OZONE)
// Ozone needs to send the primary DRM device to GPU process as early as
@@ -865,6 +865,20 @@ void GpuProcessHost::OnProcessLaunchFailed(int error_code) {
}
void GpuProcessHost::OnProcessCrashed(int exit_code) {
+ // If the GPU process crashed while compiling a shader, we may have invalid
+ // cached binaries. Completely clear the shader cache to force shader binaries
+ // to be re-created.
+ if (activity_flags_.IsFlagSet(
+ gpu::ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY)) {
+ for (auto cache_key : client_id_to_shader_cache_) {
+ // This call will temporarily extend the lifetime of the cache (kept
+ // alive in the factory), and may drop loads of cached shader binaries if
+ // it takes a while to complete. As we are intentionally dropping all
+ // binaries, this behavior is fine.
+ GetShaderCacheFactorySingleton()->ClearByClientId(
+ cache_key.first, base::Time(), base::Time::Max(), base::Bind([] {}));
+ }
+ }
SendOutstandingReplies();
RecordProcessCrash();
GpuDataManagerImpl::GetInstance()->ProcessCrashed(
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/gpu/gpu_child_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698