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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 DCHECK(send_destroying_video_surface_done_cb_.is_null()); | 813 DCHECK(send_destroying_video_surface_done_cb_.is_null()); |
812 DCHECK(!done_cb.is_null()); | 814 DCHECK(!done_cb.is_null()); |
813 if (Send(new GpuMsg_DestroyingVideoSurface(surface_id))) { | 815 if (Send(new GpuMsg_DestroyingVideoSurface(surface_id))) { |
814 send_destroying_video_surface_done_cb_ = done_cb; | 816 send_destroying_video_surface_done_cb_ = done_cb; |
815 } else { | 817 } else { |
816 done_cb.Run(); | 818 done_cb.Run(); |
817 } | 819 } |
818 } | 820 } |
819 #endif | 821 #endif |
820 | 822 |
821 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { | 823 void GpuProcessHost::OnInitialized( |
| 824 bool result, |
| 825 const gpu::GPUInfo& gpu_info, |
| 826 const gpu::GpuFeatureInfo& gpu_feature_info) { |
822 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); | 827 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); |
823 initialized_ = result; | 828 initialized_ = result; |
824 gpu_info_ = gpu_info; | 829 gpu_info_ = gpu_info; |
825 | 830 |
826 if (!initialized_) | 831 if (!initialized_) { |
827 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); | 832 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); |
828 else | 833 return; |
829 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); | 834 } |
| 835 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); |
| 836 GpuDataManagerImpl::GetInstance()->UpdateGpuFeatureInfo(gpu_feature_info); |
830 } | 837 } |
831 | 838 |
832 void GpuProcessHost::OnChannelEstablished( | 839 void GpuProcessHost::OnChannelEstablished( |
833 const IPC::ChannelHandle& channel_handle) { | 840 const IPC::ChannelHandle& channel_handle) { |
834 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); | 841 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); |
835 | 842 |
836 if (channel_requests_.empty()) { | 843 if (channel_requests_.empty()) { |
837 // This happens when GPU process is compromised. | 844 // This happens when GPU process is compromised. |
838 RouteOnUIThread(GpuHostMsg_OnLogMessage( | 845 RouteOnUIThread(GpuHostMsg_OnLogMessage( |
839 logging::LOG_WARNING, "WARNING", | 846 logging::LOG_WARNING, "WARNING", |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1243 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1237 ClientIdToShaderCacheMap::iterator iter = | 1244 ClientIdToShaderCacheMap::iterator iter = |
1238 client_id_to_shader_cache_.find(client_id); | 1245 client_id_to_shader_cache_.find(client_id); |
1239 // If the cache doesn't exist then this is an off the record profile. | 1246 // If the cache doesn't exist then this is an off the record profile. |
1240 if (iter == client_id_to_shader_cache_.end()) | 1247 if (iter == client_id_to_shader_cache_.end()) |
1241 return; | 1248 return; |
1242 iter->second->Cache(GetShaderPrefixKey(shader) + ":" + key, shader); | 1249 iter->second->Cache(GetShaderPrefixKey(shader) + ":" + key, shader); |
1243 } | 1250 } |
1244 | 1251 |
1245 } // namespace content | 1252 } // namespace content |
OLD | NEW |