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 <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
16 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "content/common/gpu/gpu_config.h" | 18 #include "content/common/gpu/gpu_config.h" |
| 19 #include "content/common/sandbox_linux.h" |
19 #include "content/gpu/gpu_child_thread.h" | 20 #include "content/gpu/gpu_child_thread.h" |
20 #include "content/gpu/gpu_info_collector.h" | 21 #include "content/gpu/gpu_info_collector.h" |
21 #include "content/gpu/gpu_process.h" | 22 #include "content/gpu/gpu_process.h" |
22 #include "content/gpu/gpu_watchdog_thread.h" | 23 #include "content/gpu/gpu_watchdog_thread.h" |
23 #include "content/public/common/content_client.h" | 24 #include "content/public/common/content_client.h" |
24 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
25 #include "content/public/common/gpu_switching_option.h" | 26 #include "content/public/common/gpu_switching_option.h" |
26 #include "content/public/common/main_function_params.h" | 27 #include "content/public/common/main_function_params.h" |
27 #include "crypto/hmac.h" | 28 #include "crypto/hmac.h" |
28 #include "ui/gl/gl_implementation.h" | 29 #include "ui/gl/gl_implementation.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 TRACE_EVENT0("gpu", "Initialize sandbox"); | 225 TRACE_EVENT0("gpu", "Initialize sandbox"); |
225 bool do_init_sandbox = true; | 226 bool do_init_sandbox = true; |
226 | 227 |
227 #if defined(OS_CHROMEOS) && defined(NDEBUG) | 228 #if defined(OS_CHROMEOS) && defined(NDEBUG) |
228 // On Chrome OS and when not on a debug build, initialize | 229 // On Chrome OS and when not on a debug build, initialize |
229 // the GPU process' sandbox only for Intel GPUs. | 230 // the GPU process' sandbox only for Intel GPUs. |
230 do_init_sandbox = gpu_info.gpu.vendor_id == 0x8086; // Intel GPU. | 231 do_init_sandbox = gpu_info.gpu.vendor_id == 0x8086; // Intel GPU. |
231 #endif | 232 #endif |
232 | 233 |
233 if (do_init_sandbox) { | 234 if (do_init_sandbox) { |
234 if (watchdog_thread.get()) | 235 if (watchdog_thread.get()) { |
235 watchdog_thread->Stop(); | 236 watchdog_thread->Stop(); |
236 gpu_info.sandboxed = InitializeSandbox(); | 237 } |
237 if (watchdog_thread.get()) | 238 gpu_info.sandboxed = |
| 239 LinuxSandbox::InitializeSandbox(LinuxSandbox::SANDBOX_CONFIG_GPU); |
| 240 if (watchdog_thread.get()) { |
238 watchdog_thread->Start(); | 241 watchdog_thread->Start(); |
| 242 } |
239 } | 243 } |
240 } | 244 } |
241 #endif | 245 #endif |
242 | 246 |
243 #if defined(OS_WIN) | 247 #if defined(OS_WIN) |
244 { | 248 { |
245 TRACE_EVENT0("gpu", "Lower token"); | 249 TRACE_EVENT0("gpu", "Lower token"); |
246 // For windows, if the target_services interface is not zero, the process | 250 // For windows, if the target_services interface is not zero, the process |
247 // is sandboxed and we must call LowerToken() before rendering untrusted | 251 // is sandboxed and we must call LowerToken() before rendering untrusted |
248 // content. | 252 // content. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 TRACE_EVENT0("gpu", "Initialize DXVA"); | 358 TRACE_EVENT0("gpu", "Initialize DXVA"); |
355 // Initialize H/W video decoding stuff which fails in the sandbox. | 359 // Initialize H/W video decoding stuff which fails in the sandbox. |
356 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); | 360 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
357 } | 361 } |
358 #endif | 362 #endif |
359 } | 363 } |
360 | 364 |
361 } // namespace. | 365 } // namespace. |
362 | 366 |
363 } // namespace content | 367 } // namespace content |
OLD | NEW |