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
3 // found in the LICENSE file.
5 #include "content/renderer/renderer_main_platform_delegate.h"
7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "content/public/common/content_switches.h"
11 #ifdef USE_SECCOMP_BPF
12 #include "content/common/sandbox_linux/android/sandbox_bpf_base_policy_android.h"
13 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
16 #ifdef ENABLE_VTUNE_JIT_INTERFACE
17 #include "v8/src/third_party/vtune/v8-vtune.h"
22 RendererMainPlatformDelegate::RendererMainPlatformDelegate(
23 const MainFunctionParams
& parameters
)
24 : parameters_(parameters
) {
27 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() {
30 void RendererMainPlatformDelegate::PlatformInitialize() {
31 #ifdef ENABLE_VTUNE_JIT_INTERFACE
32 const CommandLine
& command_line
= parameters_
.command_line
;
33 if (command_line
.HasSwitch(switches::kEnableVtune
))
34 vTune::InitializeVtuneForV8();
38 void RendererMainPlatformDelegate::PlatformUninitialize() {
41 bool RendererMainPlatformDelegate::EnableSandbox() {
42 #ifdef USE_SECCOMP_BPF
43 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
44 switches::kEnableSeccompFilterSandbox
)) {
48 sandbox::SandboxBPF sandbox
;
49 sandbox
.SetSandboxPolicy(new SandboxBPFBasePolicyAndroid());
50 CHECK(sandbox
.StartSandbox(sandbox::SandboxBPF::PROCESS_MULTI_THREADED
));
55 } // namespace content