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