| 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/renderer/renderer_main_platform_delegate.h" | 5 #include "content/renderer/renderer_main_platform_delegate.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 6 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/common/sandbox_linux/android/sandbox_bpf_base_policy_android.h
" |
| 10 #include "content/public/common/content_switches.h" |
| 11 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
| 7 | 12 |
| 8 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 13 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
| 9 #include "content/public/common/content_switches.h" | |
| 10 #include "v8/src/third_party/vtune/v8-vtune.h" | 14 #include "v8/src/third_party/vtune/v8-vtune.h" |
| 11 #endif | 15 #endif |
| 12 | 16 |
| 13 namespace content { | 17 namespace content { |
| 14 | 18 |
| 15 RendererMainPlatformDelegate::RendererMainPlatformDelegate( | 19 RendererMainPlatformDelegate::RendererMainPlatformDelegate( |
| 16 const MainFunctionParams& parameters) | 20 const MainFunctionParams& parameters) |
| 17 : parameters_(parameters) { | 21 : parameters_(parameters) { |
| 18 } | 22 } |
| 19 | 23 |
| 20 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { | 24 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() { |
| 21 } | 25 } |
| 22 | 26 |
| 23 void RendererMainPlatformDelegate::PlatformInitialize() { | 27 void RendererMainPlatformDelegate::PlatformInitialize() { |
| 24 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 28 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
| 25 const CommandLine& command_line = parameters_.command_line; | 29 const CommandLine& command_line = parameters_.command_line; |
| 26 if (command_line.HasSwitch(switches::kEnableVtune)) | 30 if (command_line.HasSwitch(switches::kEnableVtune)) |
| 27 vTune::InitializeVtuneForV8(); | 31 vTune::InitializeVtuneForV8(); |
| 28 #endif | 32 #endif |
| 29 } | 33 } |
| 30 | 34 |
| 31 void RendererMainPlatformDelegate::PlatformUninitialize() { | 35 void RendererMainPlatformDelegate::PlatformUninitialize() { |
| 32 } | 36 } |
| 33 | 37 |
| 34 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { | 38 bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { |
| 35 return true; | 39 return true; |
| 36 } | 40 } |
| 37 | 41 |
| 38 bool RendererMainPlatformDelegate::EnableSandbox() { | 42 bool RendererMainPlatformDelegate::EnableSandbox() { |
| 43 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 44 switches::kEnableSeccompFilterSandbox)) { |
| 45 return true; |
| 46 } |
| 47 |
| 48 sandbox::SandboxBPF sandbox; |
| 49 sandbox.SetSandboxPolicy(new SandboxBPFBasePolicyAndroid()); |
| 50 CHECK(sandbox.StartSandbox(sandbox::SandboxBPF::PROCESS_MULTI_THREADED)); |
| 39 return true; | 51 return true; |
| 40 } | 52 } |
| 41 | 53 |
| 42 void RendererMainPlatformDelegate::RunSandboxTests(bool no_sandbox) { | 54 void RendererMainPlatformDelegate::RunSandboxTests(bool no_sandbox) { |
| 43 } | 55 } |
| 44 | 56 |
| 45 } // namespace content | 57 } // namespace content |
| OLD | NEW |