| 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <dwmapi.h> | 8 #include <dwmapi.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/metrics/statistics_recorder.h" | 15 #include "base/metrics/statistics_recorder.h" |
| 16 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 19 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 20 #include "base/threading/platform_thread.h" | 20 #include "base/threading/platform_thread.h" |
| 21 #include "base/trace_event/trace_event.h" | 21 #include "base/trace_event/trace_event.h" |
| 22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 23 #include "content/child/child_process.h" | 23 #include "content/child/child_process.h" |
| 24 #include "content/common/content_constants_internal.h" | 24 #include "content/common/content_constants_internal.h" |
| 25 #include "content/common/gpu/gpu_config.h" | 25 #include "content/common/gpu/gpu_config.h" |
| 26 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 26 #include "content/common/gpu/gpu_messages.h" | 27 #include "content/common/gpu/gpu_messages.h" |
| 27 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 28 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 28 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" | 29 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" |
| 29 #include "content/common/sandbox_linux/sandbox_linux.h" | 30 #include "content/common/sandbox_linux/sandbox_linux.h" |
| 30 #include "content/gpu/gpu_child_thread.h" | 31 #include "content/gpu/gpu_child_thread.h" |
| 31 #include "content/gpu/gpu_process.h" | 32 #include "content/gpu/gpu_process.h" |
| 32 #include "content/gpu/gpu_watchdog_thread.h" | 33 #include "content/gpu/gpu_watchdog_thread.h" |
| 33 #include "content/public/common/content_client.h" | 34 #include "content/public/common/content_client.h" |
| 34 #include "content/public/common/content_switches.h" | 35 #include "content/public/common/content_switches.h" |
| 35 #include "content/public/common/main_function_params.h" | 36 #include "content/public/common/main_function_params.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 gpu_info.video_decode_accelerator_supported_profiles = | 357 gpu_info.video_decode_accelerator_supported_profiles = |
| 357 content::GpuVideoDecodeAccelerator::GetSupportedProfiles(); | 358 content::GpuVideoDecodeAccelerator::GetSupportedProfiles(); |
| 358 gpu_info.video_encode_accelerator_supported_profiles = | 359 gpu_info.video_encode_accelerator_supported_profiles = |
| 359 content::GpuVideoEncodeAccelerator::GetSupportedProfiles(); | 360 content::GpuVideoEncodeAccelerator::GetSupportedProfiles(); |
| 360 } else { | 361 } else { |
| 361 dead_on_arrival = true; | 362 dead_on_arrival = true; |
| 362 } | 363 } |
| 363 | 364 |
| 364 logging::SetLogMessageHandler(NULL); | 365 logging::SetLogMessageHandler(NULL); |
| 365 | 366 |
| 367 std::vector<gfx::GpuMemoryBufferType> supported_types; |
| 368 GpuMemoryBufferFactory::GetSupportedTypes(&supported_types); |
| 369 DCHECK(!supported_types.empty()); |
| 370 // Note: We always use the preferred type. |
| 371 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory = |
| 372 GpuMemoryBufferFactory::Create(supported_types[0]); |
| 373 |
| 366 GpuProcess gpu_process; | 374 GpuProcess gpu_process; |
| 367 | 375 |
| 368 GpuChildThread* child_thread = new GpuChildThread(watchdog_thread.get(), | 376 GpuChildThread* child_thread = new GpuChildThread( |
| 369 dead_on_arrival, | 377 watchdog_thread.get(), dead_on_arrival, gpu_info, deferred_messages.Get(), |
| 370 gpu_info, | 378 gpu_memory_buffer_factory.get()); |
| 371 deferred_messages.Get()); | |
| 372 while (!deferred_messages.Get().empty()) | 379 while (!deferred_messages.Get().empty()) |
| 373 deferred_messages.Get().pop(); | 380 deferred_messages.Get().pop(); |
| 374 | 381 |
| 375 child_thread->Init(start_time); | 382 child_thread->Init(start_time); |
| 376 | 383 |
| 377 gpu_process.set_main_thread(child_thread); | 384 gpu_process.set_main_thread(child_thread); |
| 378 | 385 |
| 379 if (watchdog_thread.get()) | 386 if (watchdog_thread.get()) |
| 380 watchdog_thread->AddPowerObserver(); | 387 watchdog_thread->AddPowerObserver(); |
| 381 | 388 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 return true; | 559 return true; |
| 553 } | 560 } |
| 554 | 561 |
| 555 return false; | 562 return false; |
| 556 } | 563 } |
| 557 #endif // defined(OS_WIN) | 564 #endif // defined(OS_WIN) |
| 558 | 565 |
| 559 } // namespace. | 566 } // namespace. |
| 560 | 567 |
| 561 } // namespace content | 568 } // namespace content |
| OLD | NEW |