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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 DCHECK(gpu_data_manager); | 362 DCHECK(gpu_data_manager); |
363 if (!gpu_data_manager->GpuAccessAllowed(NULL)) | 363 if (!gpu_data_manager->GpuAccessAllowed(NULL)) |
364 return NULL; | 364 return NULL; |
365 | 365 |
366 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) | 366 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) |
367 return g_gpu_process_hosts[kind]; | 367 return g_gpu_process_hosts[kind]; |
368 | 368 |
369 if (!force_create) | 369 if (!force_create) |
370 return nullptr; | 370 return nullptr; |
371 | 371 |
| 372 // Do not create a new process if browser is shutting down. |
| 373 if (BrowserMainRunner::ExitedMainMessageLoop()) |
| 374 return nullptr; |
| 375 |
372 static int last_host_id = 0; | 376 static int last_host_id = 0; |
373 int host_id; | 377 int host_id; |
374 host_id = ++last_host_id; | 378 host_id = ++last_host_id; |
375 | 379 |
376 GpuProcessHost* host = new GpuProcessHost(host_id, kind); | 380 GpuProcessHost* host = new GpuProcessHost(host_id, kind); |
377 if (host->Init()) | 381 if (host->Init()) |
378 return host; | 382 return host; |
379 | 383 |
380 // TODO(sievers): Revisit this behavior. It's not really a crash, but we also | 384 // TODO(sievers): Revisit this behavior. It's not really a crash, but we also |
381 // want the fallback-to-sw behavior if we cannot initialize the GPU. | 385 // want the fallback-to-sw behavior if we cannot initialize the GPU. |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 if (!cache.get()) | 1181 if (!cache.get()) |
1178 return; | 1182 return; |
1179 | 1183 |
1180 cache->set_shader_loaded_callback(base::Bind(&GpuProcessHost::LoadedShader, | 1184 cache->set_shader_loaded_callback(base::Bind(&GpuProcessHost::LoadedShader, |
1181 weak_ptr_factory_.GetWeakPtr())); | 1185 weak_ptr_factory_.GetWeakPtr())); |
1182 | 1186 |
1183 client_id_to_shader_cache_[client_id] = cache; | 1187 client_id_to_shader_cache_[client_id] = cache; |
1184 } | 1188 } |
1185 | 1189 |
1186 } // namespace content | 1190 } // namespace content |
OLD | NEW |