| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 #if defined(OS_ANDROID) | 51 #if defined(OS_ANDROID) |
| 52 #include "base/trace_event/memory_dump_manager.h" | 52 #include "base/trace_event/memory_dump_manager.h" |
| 53 #include "components/tracing/graphics_memory_dump_provider_android.h" | 53 #include "components/tracing/graphics_memory_dump_provider_android.h" |
| 54 #endif | 54 #endif |
| 55 | 55 |
| 56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
| 57 #include "base/win/windows_version.h" | 57 #include "base/win/windows_version.h" |
| 58 #include "base/win/scoped_com_initializer.h" | 58 #include "base/win/scoped_com_initializer.h" |
| 59 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" | 59 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" |
| 60 #include "sandbox/win/src/sandbox.h" | |
| 61 #endif | 60 #endif |
| 62 | 61 |
| 63 #if defined(USE_X11) | 62 #if defined(USE_X11) |
| 64 #include "ui/base/x/x11_util.h" | 63 #include "ui/base/x/x11_util.h" |
| 65 #include "ui/gfx/x/x11_switches.h" | 64 #include "ui/gfx/x/x11_switches.h" |
| 66 #endif | 65 #endif |
| 67 | 66 |
| 68 #if defined(OS_LINUX) | 67 #if defined(OS_LINUX) |
| 69 #include "content/public/common/sandbox_init.h" | 68 #include "content/public/common/sandbox_init.h" |
| 70 #endif | 69 #endif |
| (...skipping 29 matching lines...) Expand all Loading... |
| 100 #if !defined(OS_MACOSX) | 99 #if !defined(OS_MACOSX) |
| 101 bool CollectGraphicsInfo(gpu::GPUInfo& gpu_info); | 100 bool CollectGraphicsInfo(gpu::GPUInfo& gpu_info); |
| 102 #endif | 101 #endif |
| 103 | 102 |
| 104 #if defined(OS_LINUX) | 103 #if defined(OS_LINUX) |
| 105 #if !defined(OS_CHROMEOS) | 104 #if !defined(OS_CHROMEOS) |
| 106 bool CanAccessNvidiaDeviceFile(); | 105 bool CanAccessNvidiaDeviceFile(); |
| 107 #endif | 106 #endif |
| 108 bool StartSandboxLinux(const gpu::GPUInfo&, GpuWatchdogThread*, bool); | 107 bool StartSandboxLinux(const gpu::GPUInfo&, GpuWatchdogThread*, bool); |
| 109 #elif defined(OS_WIN) | 108 #elif defined(OS_WIN) |
| 110 bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo*); | |
| 111 #endif | 109 #endif |
| 112 | 110 |
| 113 base::LazyInstance<GpuChildThread::DeferredMessages> deferred_messages = | 111 base::LazyInstance<GpuChildThread::DeferredMessages> deferred_messages = |
| 114 LAZY_INSTANCE_INITIALIZER; | 112 LAZY_INSTANCE_INITIALIZER; |
| 115 | 113 |
| 116 bool GpuProcessLogMessageHandler(int severity, | 114 bool GpuProcessLogMessageHandler(int severity, |
| 117 const char* file, int line, | 115 const char* file, int line, |
| 118 size_t message_start, | 116 size_t message_start, |
| 119 const std::string& str) { | 117 const std::string& str) { |
| 120 std::string header = str.substr(0, message_start); | 118 std::string header = str.substr(0, message_start); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 360 |
| 363 #if defined(OS_LINUX) | 361 #if defined(OS_LINUX) |
| 364 should_initialize_gl_context = !initialized_gl_context && | 362 should_initialize_gl_context = !initialized_gl_context && |
| 365 !dead_on_arrival; | 363 !dead_on_arrival; |
| 366 | 364 |
| 367 if (!initialized_sandbox) { | 365 if (!initialized_sandbox) { |
| 368 gpu_info.sandboxed = StartSandboxLinux(gpu_info, watchdog_thread.get(), | 366 gpu_info.sandboxed = StartSandboxLinux(gpu_info, watchdog_thread.get(), |
| 369 should_initialize_gl_context); | 367 should_initialize_gl_context); |
| 370 } | 368 } |
| 371 #elif defined(OS_WIN) | 369 #elif defined(OS_WIN) |
| 372 gpu_info.sandboxed = StartSandboxWindows(parameters.sandbox_info); | 370 gpu_info.sandboxed = false; |
| 373 #elif defined(OS_MACOSX) | 371 #elif defined(OS_MACOSX) |
| 374 gpu_info.sandboxed = Sandbox::SandboxIsCurrentlyActive(); | 372 gpu_info.sandboxed = Sandbox::SandboxIsCurrentlyActive(); |
| 375 #endif | 373 #endif |
| 376 } else { | 374 } else { |
| 377 dead_on_arrival = true; | 375 dead_on_arrival = true; |
| 378 } | 376 } |
| 379 | 377 |
| 380 logging::SetLogMessageHandler(NULL); | 378 logging::SetLogMessageHandler(NULL); |
| 381 | 379 |
| 382 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory; | 380 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 if (watchdog_thread) { | 562 if (watchdog_thread) { |
| 565 base::Thread::Options options; | 563 base::Thread::Options options; |
| 566 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 564 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 567 watchdog_thread->StartWithOptions(options); | 565 watchdog_thread->StartWithOptions(options); |
| 568 } | 566 } |
| 569 | 567 |
| 570 return res; | 568 return res; |
| 571 } | 569 } |
| 572 #endif // defined(OS_LINUX) | 570 #endif // defined(OS_LINUX) |
| 573 | 571 |
| 574 #if defined(OS_WIN) | |
| 575 bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo* sandbox_info) { | |
| 576 TRACE_EVENT0("gpu,startup", "Lower token"); | |
| 577 | |
| 578 // For Windows, if the target_services interface is not zero, the process | |
| 579 // is sandboxed and we must call LowerToken() before rendering untrusted | |
| 580 // content. | |
| 581 sandbox::TargetServices* target_services = sandbox_info->target_services; | |
| 582 if (target_services) { | |
| 583 target_services->LowerToken(); | |
| 584 return true; | |
| 585 } | |
| 586 | |
| 587 return false; | |
| 588 } | |
| 589 #endif // defined(OS_WIN) | |
| 590 | |
| 591 } // namespace. | 572 } // namespace. |
| 592 | 573 |
| 593 } // namespace content | 574 } // namespace content |
| OLD | NEW |