From dc7864aebc7b8291fb7f20cac0b093695b79f757 Mon Sep 17 00:00:00 2001 From: tzik Date: Sun, 13 Mar 2016 23:07:31 -0700 Subject: Replace base::Tuple in //sandbox with std::tuple BUG=554987 Review URL: https://codereview.chromium.org/1769053002 Cr-Commit-Position: refs/heads/master@{#380934} --- sandbox/linux/bpf_dsl/codegen.cc | 14 -------------- sandbox/linux/bpf_dsl/codegen.h | 9 +++------ 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/sandbox/linux/bpf_dsl/codegen.cc b/sandbox/linux/bpf_dsl/codegen.cc index 647f55a..d88bd53 100644 --- a/sandbox/linux/bpf_dsl/codegen.cc +++ b/sandbox/linux/bpf_dsl/codegen.cc @@ -144,18 +144,4 @@ size_t CodeGen::Offset(Node target) const { return (program_.size() - 1) - target; } -// TODO(mdempsky): Move into a general base::Tuple helper library. -bool CodeGen::MemoKeyLess::operator()(const MemoKey& lhs, - const MemoKey& rhs) const { - if (base::get<0>(lhs) != base::get<0>(rhs)) - return base::get<0>(lhs) < base::get<0>(rhs); - if (base::get<1>(lhs) != base::get<1>(rhs)) - return base::get<1>(lhs) < base::get<1>(rhs); - if (base::get<2>(lhs) != base::get<2>(rhs)) - return base::get<2>(lhs) < base::get<2>(rhs); - if (base::get<3>(lhs) != base::get<3>(rhs)) - return base::get<3>(lhs) < base::get<3>(rhs); - return false; -} - } // namespace sandbox diff --git a/sandbox/linux/bpf_dsl/codegen.h b/sandbox/linux/bpf_dsl/codegen.h index 03c3b23..3fc3f35 100644 --- a/sandbox/linux/bpf_dsl/codegen.h +++ b/sandbox/linux/bpf_dsl/codegen.h @@ -9,10 +9,10 @@ #include #include +#include #include #include "base/macros.h" -#include "base/tuple.h" #include "sandbox/sandbox_export.h" struct sock_filter; @@ -80,10 +80,7 @@ class SANDBOX_EXPORT CodeGen { Program Compile(Node head); private: - using MemoKey = base::Tuple; - struct MemoKeyLess { - bool operator()(const MemoKey& lhs, const MemoKey& rhs) const; - }; + using MemoKey = std::tuple; // AppendInstruction adds a new instruction, ensuring that |jt| and // |jf| are within range as necessary for |code|. @@ -112,7 +109,7 @@ class SANDBOX_EXPORT CodeGen { // if it's an unconditional jump to a node semantically-equivalent to N. std::vector equivalent_; - std::map memos_; + std::map memos_; DISALLOW_COPY_AND_ASSIGN(CodeGen); }; -- cgit v1.1