Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1264)

Unified Diff: content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc

Issue 2523253002: Convert use_seccomp_bpf to the BUILDFLAG system. (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/BUILD.gn ('k') | content/renderer/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc
diff --git a/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc b/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc
index e8264cfe04e28257098fd19d316f385e634f429d..67b1d0576889190b6b00ab0537398dbc64d458b0 100644
--- a/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc
+++ b/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc
@@ -18,8 +18,9 @@
#include "build/build_config.h"
#include "content/public/common/content_switches.h"
#include "sandbox/linux/bpf_dsl/bpf_dsl.h"
+#include "sandbox/sandbox_features.h"
-#if defined(USE_SECCOMP_BPF)
+#if BUILDFLAG(USE_SECCOMP_BPF)
#include "base/files/scoped_file.h"
#include "base/posix/eintr_wrapper.h"
@@ -58,7 +59,7 @@ using sandbox::bpf_dsl::ResultExpr;
namespace content {
-#if defined(USE_SECCOMP_BPF)
+#if BUILDFLAG(USE_SECCOMP_BPF)
namespace {
// This function takes ownership of |policy|.
@@ -231,7 +232,7 @@ bool SandboxSeccompBPF::IsSeccompBPFDesired() {
#if !defined(OS_NACL_NONSFI)
bool SandboxSeccompBPF::ShouldEnableSeccompBPF(
const std::string& process_type) {
-#if defined(USE_SECCOMP_BPF)
+#if BUILDFLAG(USE_SECCOMP_BPF)
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (process_type == switches::kGpuProcess)
@@ -244,7 +245,7 @@ bool SandboxSeccompBPF::ShouldEnableSeccompBPF(
#endif // !defined(OS_NACL_NONSFI)
bool SandboxSeccompBPF::SupportsSandbox() {
-#if defined(USE_SECCOMP_BPF)
+#if BUILDFLAG(USE_SECCOMP_BPF)
return SandboxBPF::SupportsSeccompSandbox(
SandboxBPF::SeccompLevel::SINGLE_THREADED);
#endif
@@ -253,7 +254,7 @@ bool SandboxSeccompBPF::SupportsSandbox() {
#if !defined(OS_NACL_NONSFI)
bool SandboxSeccompBPF::SupportsSandboxWithTsync() {
-#if defined(USE_SECCOMP_BPF)
+#if BUILDFLAG(USE_SECCOMP_BPF)
return SandboxBPF::SupportsSeccompSandbox(
SandboxBPF::SeccompLevel::MULTI_THREADED);
#endif
@@ -262,7 +263,7 @@ bool SandboxSeccompBPF::SupportsSandboxWithTsync() {
bool SandboxSeccompBPF::StartSandbox(const std::string& process_type,
base::ScopedFD proc_fd) {
-#if defined(USE_SECCOMP_BPF)
+#if BUILDFLAG(USE_SECCOMP_BPF)
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
@@ -284,24 +285,24 @@ bool SandboxSeccompBPF::StartSandbox(const std::string& process_type,
bool SandboxSeccompBPF::StartSandboxWithExternalPolicy(
std::unique_ptr<sandbox::bpf_dsl::Policy> policy,
base::ScopedFD proc_fd) {
-#if defined(USE_SECCOMP_BPF)
+#if BUILDFLAG(USE_SECCOMP_BPF)
if (IsSeccompBPFDesired() && SupportsSandbox()) {
CHECK(policy);
StartSandboxWithPolicy(policy.release(), std::move(proc_fd));
return true;
}
-#endif // defined(USE_SECCOMP_BPF)
+#endif // BUILDFLAG(USE_SECCOMP_BPF)
return false;
}
#if !defined(OS_NACL_NONSFI)
std::unique_ptr<sandbox::bpf_dsl::Policy>
SandboxSeccompBPF::GetBaselinePolicy() {
-#if defined(USE_SECCOMP_BPF)
+#if BUILDFLAG(USE_SECCOMP_BPF)
return std::unique_ptr<sandbox::bpf_dsl::Policy>(new BaselinePolicy);
#else
return std::unique_ptr<sandbox::bpf_dsl::Policy>();
-#endif // defined(USE_SECCOMP_BPF)
+#endif // BUILDFLAG(USE_SECCOMP_BPF)
}
#endif // !defined(OS_NACL_NONSFI)
« no previous file with comments | « content/common/BUILD.gn ('k') | content/renderer/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698