Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / sandbox / linux / bpf_dsl / test_trap_registry.h
blob161f28e34c9b6905c180732d1c27c2d86bdeadc7
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef SANDBOX_LINUX_BPF_DSL_TEST_TRAP_REGISTRY_H_
6 #define SANDBOX_LINUX_BPF_DSL_TEST_TRAP_REGISTRY_H_
8 #include <stdint.h>
10 #include <map>
11 #include <utility>
13 #include "sandbox/linux/bpf_dsl/trap_registry.h"
15 namespace sandbox {
16 namespace bpf_dsl {
18 class TestTrapRegistry : public TrapRegistry {
19 public:
20 TestTrapRegistry();
21 virtual ~TestTrapRegistry();
23 uint16_t Add(TrapFnc fnc, const void* aux, bool safe) override;
24 bool EnableUnsafeTraps() override;
26 private:
27 using Key = std::pair<TrapFnc, const void*>;
29 std::map<Key, uint16_t> map_;
31 DISALLOW_COPY_AND_ASSIGN(TestTrapRegistry);
34 } // namespace bpf_dsl
35 } // namespace sandbox
37 #endif // SANDBOX_LINUX_BPF_DSL_TEST_TRAP_REGISTRY_H_