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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 2744363002: Clear shader disk cache after glProgramBinary failure. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 628
629 OnProcessLaunched(); // Fake a callback that the process is ready. 629 OnProcessLaunched(); // Fake a callback that the process is ready.
630 } else if (!LaunchGpuProcess(&gpu_preferences)) { 630 } else if (!LaunchGpuProcess(&gpu_preferences)) {
631 return false; 631 return false;
632 } 632 }
633 633
634 process_->child_channel() 634 process_->child_channel()
635 ->GetAssociatedInterfaceSupport() 635 ->GetAssociatedInterfaceSupport()
636 ->GetRemoteAssociatedInterface(&gpu_main_ptr_); 636 ->GetRemoteAssociatedInterface(&gpu_main_ptr_);
637 ui::mojom::GpuServiceRequest request(&gpu_service_ptr_); 637 ui::mojom::GpuServiceRequest request(&gpu_service_ptr_);
638 gpu_main_ptr_->CreateGpuService(std::move(request), 638 gpu_main_ptr_->CreateGpuService(
639 gpu_host_binding_.CreateInterfacePtrAndBind(), 639 std::move(request), gpu_host_binding_.CreateInterfacePtrAndBind(),
640 gpu_preferences); 640 gpu_preferences, activity_flags_.CloneHandle());
641 641
642 #if defined(USE_OZONE) 642 #if defined(USE_OZONE)
643 // Ozone needs to send the primary DRM device to GPU process as early as 643 // Ozone needs to send the primary DRM device to GPU process as early as
644 // possible to ensure the latter always has a valid device. crbug.com/608839 644 // possible to ensure the latter always has a valid device. crbug.com/608839
645 ui::OzonePlatform::GetInstance() 645 ui::OzonePlatform::GetInstance()
646 ->GetGpuPlatformSupportHost() 646 ->GetGpuPlatformSupportHost()
647 ->OnGpuProcessLaunched( 647 ->OnGpuProcessLaunched(
648 host_id_, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), 648 host_id_, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
649 base::Bind(&SendGpuProcessMessageByHostId, host_id_)); 649 base::Bind(&SendGpuProcessMessageByHostId, host_id_));
650 #endif 650 #endif
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime", 857 UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime",
858 base::TimeTicks::Now() - init_start_time_); 858 base::TimeTicks::Now() - init_start_time_);
859 } 859 }
860 860
861 void GpuProcessHost::OnProcessLaunchFailed(int error_code) { 861 void GpuProcessHost::OnProcessLaunchFailed(int error_code) {
862 // TODO(wfh): do something more useful with this error code. 862 // TODO(wfh): do something more useful with this error code.
863 RecordProcessCrash(); 863 RecordProcessCrash();
864 } 864 }
865 865
866 void GpuProcessHost::OnProcessCrashed(int exit_code) { 866 void GpuProcessHost::OnProcessCrashed(int exit_code) {
867 // If the GPU process crashed while compiling a shader, we may have invalid
868 // cached binaries. Completely clear the shader cache to force shader binaries
869 // to be re-created.
870 if (activity_flags_.IsFlagSet(
871 gpu::ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY)) {
872 for (auto cache_key : client_id_to_shader_cache_) {
873 cache_key.second->Clear(base::Time(), base::Time::Max(),
874 net::CompletionCallback());
875 }
876 }
867 SendOutstandingReplies(); 877 SendOutstandingReplies();
868 RecordProcessCrash(); 878 RecordProcessCrash();
869 GpuDataManagerImpl::GetInstance()->ProcessCrashed( 879 GpuDataManagerImpl::GetInstance()->ProcessCrashed(
870 process_->GetTerminationStatus(true /* known_dead */, NULL)); 880 process_->GetTerminationStatus(true /* known_dead */, NULL));
871 } 881 }
872 882
873 void GpuProcessHost::DidInitialize(const gpu::GPUInfo& gpu_info) { 883 void GpuProcessHost::DidInitialize(const gpu::GPUInfo& gpu_info) {
874 // TODO(sad): This should call OnInitialized(). 884 // TODO(sad): This should call OnInitialized().
875 } 885 }
876 886
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 GetShaderCacheFactorySingleton()->Get(client_id); 1221 GetShaderCacheFactorySingleton()->Get(client_id);
1212 if (!cache.get()) 1222 if (!cache.get())
1213 return; 1223 return;
1214 1224
1215 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); 1225 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_));
1216 1226
1217 client_id_to_shader_cache_[client_id] = cache; 1227 client_id_to_shader_cache_[client_id] = cache;
1218 } 1228 }
1219 1229
1220 } // namespace content 1230 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698