| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 #endif | 255 #endif |
| 256 | 256 |
| 257 gpu_init.set_sandbox_helper(&sandbox_helper); | 257 gpu_init.set_sandbox_helper(&sandbox_helper); |
| 258 | 258 |
| 259 // Gpu initialization may fail for various reasons, in which case we will need | 259 // Gpu initialization may fail for various reasons, in which case we will need |
| 260 // to tear down this process. However, we can not do so safely until the IPC | 260 // to tear down this process. However, we can not do so safely until the IPC |
| 261 // channel is set up, because the detection of early return of a child process | 261 // channel is set up, because the detection of early return of a child process |
| 262 // is implemented using an IPC channel error. If the IPC channel is not fully | 262 // is implemented using an IPC channel error. If the IPC channel is not fully |
| 263 // set up between the browser and GPU process, and the GPU process crashes or | 263 // set up between the browser and GPU process, and the GPU process crashes or |
| 264 // exits early, the browser process will never detect it. For this reason we | 264 // exits early, the browser process will never detect it. For this reason we |
| 265 // defer tearing down the GPU process until receiving the GpuMsg_Initialize | 265 // defer tearing down the GPU process until receiving the initialization |
| 266 // message from the browser. | 266 // message from the browser (through mojom::GpuMain::CreateGpuService()). |
| 267 const bool init_success = gpu_init.InitializeAndStartSandbox(command_line); | 267 const bool init_success = gpu_init.InitializeAndStartSandbox(command_line); |
| 268 const bool dead_on_arrival = !init_success; | 268 const bool dead_on_arrival = !init_success; |
| 269 | 269 |
| 270 logging::SetLogMessageHandler(NULL); | 270 logging::SetLogMessageHandler(NULL); |
| 271 GetContentClient()->SetGpuInfo(gpu_init.gpu_info()); | 271 GetContentClient()->SetGpuInfo(gpu_init.gpu_info()); |
| 272 | 272 |
| 273 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory; | 273 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory; |
| 274 if (init_success && | 274 if (init_success && |
| 275 gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) | 275 gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) |
| 276 gpu_memory_buffer_factory = gpu::GpuMemoryBufferFactory::CreateNativeType(); | 276 gpu_memory_buffer_factory = gpu::GpuMemoryBufferFactory::CreateNativeType(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 return true; | 358 return true; |
| 359 } | 359 } |
| 360 | 360 |
| 361 return false; | 361 return false; |
| 362 } | 362 } |
| 363 #endif // defined(OS_WIN) | 363 #endif // defined(OS_WIN) |
| 364 | 364 |
| 365 } // namespace. | 365 } // namespace. |
| 366 | 366 |
| 367 } // namespace content | 367 } // namespace content |
| OLD | NEW |