diff options
author | tzik <tzik@chromium.org> | 2016-03-13 23:07:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-14 06:09:18 +0000 |
commit | dc7864aebc7b8291fb7f20cac0b093695b79f757 (patch) | |
tree | 5149b4f7f9c8c042e6eab9094a961538a9cc307e | |
parent | 39e402647a842f4fcc12faded11d486aca8eda47 (diff) | |
download | chromium_src-dc7864aebc7b8291fb7f20cac0b093695b79f757.zip chromium_src-dc7864aebc7b8291fb7f20cac0b093695b79f757.tar.gz chromium_src-dc7864aebc7b8291fb7f20cac0b093695b79f757.tar.bz2 |
Replace base::Tuple in //sandbox with std::tuple
BUG=554987
Review URL: https://codereview.chromium.org/1769053002
Cr-Commit-Position: refs/heads/master@{#380934}
-rw-r--r-- | sandbox/linux/bpf_dsl/codegen.cc | 14 | ||||
-rw-r--r-- | 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 <stdint.h> #include <map> +#include <tuple> #include <vector> #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<uint16_t, uint32_t, Node, Node>; - struct MemoKeyLess { - bool operator()(const MemoKey& lhs, const MemoKey& rhs) const; - }; + using MemoKey = std::tuple<uint16_t, uint32_t, Node, Node>; // 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<Node> equivalent_; - std::map<MemoKey, Node, MemoKeyLess> memos_; + std::map<MemoKey, Node> memos_; DISALLOW_COPY_AND_ASSIGN(CodeGen); }; |