| OLD | NEW |
| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 int GpuProcessHost::swiftshader_crash_count_ = 0; | 108 int GpuProcessHost::swiftshader_crash_count_ = 0; |
| 109 | 109 |
| 110 namespace { | 110 namespace { |
| 111 | 111 |
| 112 // Command-line switches to propagate to the GPU process. | 112 // Command-line switches to propagate to the GPU process. |
| 113 static const char* const kSwitchNames[] = { | 113 static const char* const kSwitchNames[] = { |
| 114 switches::kCreateDefaultGLContext, | 114 switches::kCreateDefaultGLContext, |
| 115 switches::kDisableAcceleratedVideoDecode, | 115 switches::kDisableAcceleratedVideoDecode, |
| 116 switches::kDisableBreakpad, | 116 switches::kDisableBreakpad, |
| 117 switches::kDisableES3GLContext, | 117 switches::kDisableES3GLContext, |
| 118 switches::kDisableGpuRasterization, |
| 118 switches::kDisableGpuSandbox, | 119 switches::kDisableGpuSandbox, |
| 119 switches::kDisableGpuWatchdog, | 120 switches::kDisableGpuWatchdog, |
| 120 switches::kDisableGLExtensions, | 121 switches::kDisableGLExtensions, |
| 121 switches::kDisableLogging, | 122 switches::kDisableLogging, |
| 122 switches::kDisableSeccompFilterSandbox, | 123 switches::kDisableSeccompFilterSandbox, |
| 123 #if BUILDFLAG(ENABLE_WEBRTC) | 124 #if BUILDFLAG(ENABLE_WEBRTC) |
| 124 switches::kDisableWebRtcHWEncoding, | 125 switches::kDisableWebRtcHWEncoding, |
| 125 #endif | 126 #endif |
| 126 #if defined(OS_WIN) | 127 #if defined(OS_WIN) |
| 127 switches::kEnableAcceleratedVpxDecode, | 128 switches::kEnableAcceleratedVpxDecode, |
| 128 #endif | 129 #endif |
| 130 switches::kEnableGpuRasterization, |
| 129 switches::kEnableHeapProfiling, | 131 switches::kEnableHeapProfiling, |
| 130 switches::kEnableLogging, | 132 switches::kEnableLogging, |
| 131 #if defined(OS_CHROMEOS) | 133 #if defined(OS_CHROMEOS) |
| 132 switches::kDisableVaapiAcceleratedVideoEncode, | 134 switches::kDisableVaapiAcceleratedVideoEncode, |
| 133 #endif | 135 #endif |
| 134 switches::kGpuDriverBugWorkarounds, | 136 switches::kGpuDriverBugWorkarounds, |
| 135 switches::kGpuStartupDialog, | 137 switches::kGpuStartupDialog, |
| 136 switches::kGpuSandboxAllowSysVShm, | 138 switches::kGpuSandboxAllowSysVShm, |
| 137 switches::kGpuSandboxFailuresFatal, | 139 switches::kGpuSandboxFailuresFatal, |
| 138 switches::kGpuSandboxStartEarly, | 140 switches::kGpuSandboxStartEarly, |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 DCHECK(send_destroying_video_surface_done_cb_.is_null()); | 778 DCHECK(send_destroying_video_surface_done_cb_.is_null()); |
| 777 DCHECK(!done_cb.is_null()); | 779 DCHECK(!done_cb.is_null()); |
| 778 if (Send(new GpuMsg_DestroyingVideoSurface(surface_id))) { | 780 if (Send(new GpuMsg_DestroyingVideoSurface(surface_id))) { |
| 779 send_destroying_video_surface_done_cb_ = done_cb; | 781 send_destroying_video_surface_done_cb_ = done_cb; |
| 780 } else { | 782 } else { |
| 781 done_cb.Run(); | 783 done_cb.Run(); |
| 782 } | 784 } |
| 783 } | 785 } |
| 784 #endif | 786 #endif |
| 785 | 787 |
| 786 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { | 788 void GpuProcessHost::OnInitialized( |
| 789 bool result, |
| 790 const gpu::GPUInfo& gpu_info, |
| 791 const gpu::GpuFeatureInfo& gpu_feature_info) { |
| 787 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); | 792 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); |
| 788 initialized_ = result; | 793 initialized_ = result; |
| 789 gpu_info_ = gpu_info; | 794 gpu_info_ = gpu_info; |
| 790 | 795 |
| 791 if (!initialized_) | 796 if (!initialized_) { |
| 792 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); | 797 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); |
| 793 else | 798 return; |
| 794 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); | 799 } |
| 800 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); |
| 801 GpuDataManagerImpl::GetInstance()->UpdateGpuFeatureInfo(gpu_feature_info); |
| 795 } | 802 } |
| 796 | 803 |
| 797 void GpuProcessHost::OnChannelEstablished( | 804 void GpuProcessHost::OnChannelEstablished( |
| 798 const IPC::ChannelHandle& channel_handle) { | 805 const IPC::ChannelHandle& channel_handle) { |
| 799 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); | 806 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); |
| 800 | 807 |
| 801 if (channel_requests_.empty()) { | 808 if (channel_requests_.empty()) { |
| 802 // This happens when GPU process is compromised. | 809 // This happens when GPU process is compromised. |
| 803 RouteOnUIThread(GpuHostMsg_OnLogMessage( | 810 RouteOnUIThread(GpuHostMsg_OnLogMessage( |
| 804 logging::LOG_WARNING, "WARNING", | 811 logging::LOG_WARNING, "WARNING", |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 GetShaderCacheFactorySingleton()->Get(client_id); | 1209 GetShaderCacheFactorySingleton()->Get(client_id); |
| 1203 if (!cache.get()) | 1210 if (!cache.get()) |
| 1204 return; | 1211 return; |
| 1205 | 1212 |
| 1206 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); | 1213 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); |
| 1207 | 1214 |
| 1208 client_id_to_shader_cache_[client_id] = cache; | 1215 client_id_to_shader_cache_[client_id] = cache; |
| 1209 } | 1216 } |
| 1210 | 1217 |
| 1211 } // namespace content | 1218 } // namespace content |
| OLD | NEW |