This source file includes following definitions.
- PlatformInitialize
- PlatformUninitialize
- InitSandboxTests
- EnableSandbox
- RunSandboxTests
#include "content/renderer/renderer_main_platform_delegate.h"
#include <errno.h>
#include <sys/stat.h>
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "content/common/sandbox_linux/sandbox_linux.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/sandbox_init.h"
#ifdef ENABLE_VTUNE_JIT_INTERFACE
#include "v8/src/third_party/vtune/v8-vtune.h"
#endif
namespace content {
RendererMainPlatformDelegate::RendererMainPlatformDelegate(
const MainFunctionParams& parameters)
: parameters_(parameters) {
}
RendererMainPlatformDelegate::~RendererMainPlatformDelegate() {
}
void RendererMainPlatformDelegate::PlatformInitialize() {
#ifdef ENABLE_VTUNE_JIT_INTERFACE
const CommandLine& command_line = parameters_.command_line;
if (command_line.HasSwitch(switches::kEnableVtune))
vTune::InitializeVtuneForV8();
#endif
}
void RendererMainPlatformDelegate::PlatformUninitialize() {
}
bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
return true;
}
bool RendererMainPlatformDelegate::EnableSandbox() {
LinuxSandbox::InitializeSandbox();
return true;
}
void RendererMainPlatformDelegate::RunSandboxTests(bool no_sandbox) {
if (no_sandbox)
return;
class LinuxSandbox* linux_sandbox = LinuxSandbox::GetInstance();
if (linux_sandbox->GetStatus() & kSandboxLinuxSeccompBPF) {
CHECK(linux_sandbox->seccomp_bpf_started());
}
if (linux_sandbox->GetStatus() & kSandboxLinuxSUID) {
CHECK(!base::PathExists(base::FilePath("/proc/cpuinfo")));
}
#if defined(__x86_64__)
if (linux_sandbox->seccomp_bpf_started()) {
errno = 0;
CHECK_EQ(fchmod(-1, 07777), -1);
CHECK_EQ(errno, EPERM);
}
#endif
}
}