| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 host->Send(message); | 193 host->Send(message); |
| 194 } else { | 194 } else { |
| 195 delete message; | 195 delete message; |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 void RunCallbackOnIO(GpuProcessHost::GpuProcessKind kind, | 199 void RunCallbackOnIO(GpuProcessHost::GpuProcessKind kind, |
| 200 bool force_create, | 200 bool force_create, |
| 201 const base::Callback<void(GpuProcessHost*)>& callback) { | 201 const base::Callback<void(GpuProcessHost*)>& callback) { |
| 202 GpuProcessHost* host = GpuProcessHost::Get(kind, force_create); | 202 GpuProcessHost* host = GpuProcessHost::Get(kind, force_create); |
| 203 if (host) | 203 callback.Run(host); |
| 204 callback.Run(host); | |
| 205 } | 204 } |
| 206 | 205 |
| 207 #if defined(USE_OZONE) | 206 #if defined(USE_OZONE) |
| 208 void SendGpuProcessMessageByHostId(int host_id, IPC::Message* message) { | 207 void SendGpuProcessMessageByHostId(int host_id, IPC::Message* message) { |
| 209 GpuProcessHost* host = GpuProcessHost::FromID(host_id); | 208 GpuProcessHost* host = GpuProcessHost::FromID(host_id); |
| 210 if (host) { | 209 if (host) { |
| 211 host->Send(message); | 210 host->Send(message); |
| 212 } else { | 211 } else { |
| 213 delete message; | 212 delete message; |
| 214 } | 213 } |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 | 980 |
| 982 void GpuProcessHost::ForceShutdown() { | 981 void GpuProcessHost::ForceShutdown() { |
| 983 // This is only called on the IO thread so no race against the constructor | 982 // This is only called on the IO thread so no race against the constructor |
| 984 // for another GpuProcessHost. | 983 // for another GpuProcessHost. |
| 985 if (g_gpu_process_hosts[kind_] == this) | 984 if (g_gpu_process_hosts[kind_] == this) |
| 986 g_gpu_process_hosts[kind_] = NULL; | 985 g_gpu_process_hosts[kind_] = NULL; |
| 987 | 986 |
| 988 process_->ForceShutdown(); | 987 process_->ForceShutdown(); |
| 989 } | 988 } |
| 990 | 989 |
| 991 void GpuProcessHost::StopGpuProcess() { | |
| 992 Send(new GpuMsg_Finalize()); | |
| 993 } | |
| 994 | |
| 995 bool GpuProcessHost::LaunchGpuProcess(gpu::GpuPreferences* gpu_preferences) { | 990 bool GpuProcessHost::LaunchGpuProcess(gpu::GpuPreferences* gpu_preferences) { |
| 996 const base::CommandLine& browser_command_line = | 991 const base::CommandLine& browser_command_line = |
| 997 *base::CommandLine::ForCurrentProcess(); | 992 *base::CommandLine::ForCurrentProcess(); |
| 998 | 993 |
| 999 base::CommandLine::StringType gpu_launcher = | 994 base::CommandLine::StringType gpu_launcher = |
| 1000 browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); | 995 browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); |
| 1001 | 996 |
| 1002 #if defined(OS_ANDROID) | 997 #if defined(OS_ANDROID) |
| 1003 // crbug.com/447735. readlink("self/proc/exe") sometimes fails on Android | 998 // crbug.com/447735. readlink("self/proc/exe") sometimes fails on Android |
| 1004 // at startup with EACCES. As a workaround ignore this here, since the | 999 // at startup with EACCES. As a workaround ignore this here, since the |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 GetShaderCacheFactorySingleton()->Get(client_id); | 1206 GetShaderCacheFactorySingleton()->Get(client_id); |
| 1212 if (!cache.get()) | 1207 if (!cache.get()) |
| 1213 return; | 1208 return; |
| 1214 | 1209 |
| 1215 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); | 1210 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); |
| 1216 | 1211 |
| 1217 client_id_to_shader_cache_[client_id] = cache; | 1212 client_id_to_shader_cache_[client_id] = cache; |
| 1218 } | 1213 } |
| 1219 | 1214 |
| 1220 } // namespace content | 1215 } // namespace content |
| OLD | NEW |