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 "content/public/common/sandbox_init.h" | 5 #include "content/public/common/sandbox_init.h" |
6 | 6 |
7 #if defined(OS_LINUX) && defined(__x86_64__) | 7 #if defined(OS_LINUX) && defined(__x86_64__) |
8 | 8 |
9 #include <asm/unistd.h> | 9 #include <asm/unistd.h> |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 namespace content { | 326 namespace content { |
327 | 327 |
328 void InitializeSandbox() { | 328 void InitializeSandbox() { |
329 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 329 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
330 if (command_line.HasSwitch(switches::kNoSandbox) || | 330 if (command_line.HasSwitch(switches::kNoSandbox) || |
331 command_line.HasSwitch(switches::kDisableSeccompFilterSandbox)) | 331 command_line.HasSwitch(switches::kDisableSeccompFilterSandbox)) |
332 return; | 332 return; |
333 | 333 |
334 std::string process_type = | 334 std::string process_type = |
335 command_line.GetSwitchValueASCII(switches::kProcessType); | 335 command_line.GetSwitchValueASCII(switches::kProcessType); |
336 if (process_type == switches::kGpuProcess && | |
337 command_line.HasSwitch(switches::kDisableGpuSandbox)) | |
338 return; | |
jln (very slow on Chromium)
2012/05/10 03:16:39
What about making a EnableGpuSandbox switch and ha
Jorge Lucangeli Obes
2012/05/10 03:38:34
Agreed, having the change in only one place makes
| |
339 | 336 |
340 if (!CanUseSeccompFilters()) | 337 if (!CanUseSeccompFilters()) |
341 return; | 338 return; |
342 | 339 |
343 CheckSingleThreaded(); | 340 CheckSingleThreaded(); |
344 | 341 |
345 std::vector<struct sock_filter> program; | 342 std::vector<struct sock_filter> program; |
346 EmitPreamble(&program); | 343 EmitPreamble(&program); |
347 | 344 |
348 if (process_type == switches::kGpuProcess) { | 345 if (process_type == switches::kPpapiPluginProcess) { |
349 ApplyGPUPolicy(&program); | |
350 } else if (process_type == switches::kPpapiPluginProcess) { | |
351 ApplyFlashPolicy(&program); | 346 ApplyFlashPolicy(&program); |
352 } else { | 347 } else { |
353 NOTREACHED(); | 348 NOTREACHED(); |
354 } | 349 } |
355 | 350 |
356 EmitTrap(&program); | 351 EmitTrap(&program); |
357 | 352 |
358 InstallSIGSYSHandler(); | 353 InstallSIGSYSHandler(); |
359 InstallFilter(program); | 354 InstallFilter(program); |
360 } | 355 } |
361 | 356 |
362 } // namespace content | 357 } // namespace content |
363 | 358 |
364 #else | 359 #else |
365 | 360 |
366 namespace content { | 361 namespace content { |
367 | 362 |
368 void InitializeSandbox() { | 363 void InitializeSandbox() { |
369 } | 364 } |
370 | 365 |
371 } // namespace content | 366 } // namespace content |
372 | 367 |
373 #endif | 368 #endif |
374 | 369 |
OLD | NEW |