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 19 matching lines...) Expand all Loading... |
30 #include "content/public/common/main_function_params.h" | 30 #include "content/public/common/main_function_params.h" |
31 #include "content/public/common/result_codes.h" | 31 #include "content/public/common/result_codes.h" |
32 #include "gpu/command_buffer/service/gpu_switches.h" | 32 #include "gpu/command_buffer/service/gpu_switches.h" |
33 #include "gpu/config/gpu_driver_bug_list.h" | 33 #include "gpu/config/gpu_driver_bug_list.h" |
34 #include "gpu/config/gpu_info_collector.h" | 34 #include "gpu/config/gpu_info_collector.h" |
35 #include "gpu/config/gpu_switches.h" | 35 #include "gpu/config/gpu_switches.h" |
36 #include "gpu/config/gpu_util.h" | 36 #include "gpu/config/gpu_util.h" |
37 #include "gpu/ipc/common/gpu_memory_buffer_support.h" | 37 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
38 #include "gpu/ipc/service/gpu_config.h" | 38 #include "gpu/ipc/service/gpu_config.h" |
39 #include "gpu/ipc/service/gpu_init.h" | 39 #include "gpu/ipc/service/gpu_init.h" |
40 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | |
41 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 40 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
42 #include "ui/events/platform/platform_event_source.h" | 41 #include "ui/events/platform/platform_event_source.h" |
43 #include "ui/gfx/switches.h" | 42 #include "ui/gfx/switches.h" |
44 #include "ui/gl/gl_context.h" | 43 #include "ui/gl/gl_context.h" |
45 #include "ui/gl/gl_implementation.h" | 44 #include "ui/gl/gl_implementation.h" |
46 #include "ui/gl/gl_surface.h" | 45 #include "ui/gl/gl_surface.h" |
47 #include "ui/gl/gl_switches.h" | 46 #include "ui/gl/gl_switches.h" |
48 #include "ui/gl/gpu_switching_manager.h" | 47 #include "ui/gl/gpu_switching_manager.h" |
49 #include "ui/gl/init/gl_factory.h" | 48 #include "ui/gl/init/gl_factory.h" |
50 | 49 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // set up between the browser and GPU process, and the GPU process crashes or | 264 // set up between the browser and GPU process, and the GPU process crashes or |
266 // exits early, the browser process will never detect it. For this reason we | 265 // exits early, the browser process will never detect it. For this reason we |
267 // defer tearing down the GPU process until receiving the initialization | 266 // defer tearing down the GPU process until receiving the initialization |
268 // message from the browser (through mojom::GpuMain::CreateGpuService()). | 267 // message from the browser (through mojom::GpuMain::CreateGpuService()). |
269 const bool init_success = gpu_init.InitializeAndStartSandbox(command_line); | 268 const bool init_success = gpu_init.InitializeAndStartSandbox(command_line); |
270 const bool dead_on_arrival = !init_success; | 269 const bool dead_on_arrival = !init_success; |
271 | 270 |
272 logging::SetLogMessageHandler(NULL); | 271 logging::SetLogMessageHandler(NULL); |
273 GetContentClient()->SetGpuInfo(gpu_init.gpu_info()); | 272 GetContentClient()->SetGpuInfo(gpu_init.gpu_info()); |
274 | 273 |
275 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory; | |
276 if (init_success && | |
277 gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) | |
278 gpu_memory_buffer_factory = gpu::GpuMemoryBufferFactory::CreateNativeType(); | |
279 | |
280 base::ThreadPriority io_thread_priority = base::ThreadPriority::NORMAL; | 274 base::ThreadPriority io_thread_priority = base::ThreadPriority::NORMAL; |
281 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 275 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
282 io_thread_priority = base::ThreadPriority::DISPLAY; | 276 io_thread_priority = base::ThreadPriority::DISPLAY; |
283 #endif | 277 #endif |
284 | 278 |
285 GpuProcess gpu_process(io_thread_priority); | 279 GpuProcess gpu_process(io_thread_priority); |
286 GpuChildThread* child_thread = new GpuChildThread( | 280 GpuChildThread* child_thread = new GpuChildThread( |
287 gpu_init.TakeWatchdogThread(), dead_on_arrival, gpu_init.gpu_info(), | 281 gpu_init.TakeWatchdogThread(), dead_on_arrival, gpu_init.gpu_info(), |
288 gpu_init.gpu_feature_info(), std::move(deferred_messages.Get()), | 282 gpu_init.gpu_feature_info(), std::move(deferred_messages.Get())); |
289 gpu_memory_buffer_factory.get()); | |
290 deferred_messages.Get().clear(); | 283 deferred_messages.Get().clear(); |
291 | 284 |
292 child_thread->Init(start_time); | 285 child_thread->Init(start_time); |
293 | 286 |
294 gpu_process.set_main_thread(child_thread); | 287 gpu_process.set_main_thread(child_thread); |
295 | 288 |
296 #if defined(OS_ANDROID) | 289 #if defined(OS_ANDROID) |
297 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 290 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
298 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics", | 291 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics", |
299 nullptr); | 292 nullptr); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 return true; | 350 return true; |
358 } | 351 } |
359 | 352 |
360 return false; | 353 return false; |
361 } | 354 } |
362 #endif // defined(OS_WIN) | 355 #endif // defined(OS_WIN) |
363 | 356 |
364 } // namespace. | 357 } // namespace. |
365 | 358 |
366 } // namespace content | 359 } // namespace content |
OLD | NEW |