| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SANDBOX_LINUX_BPF_DSL_TEST_TRAP_REGISTRY_H_ | 5 #ifndef SANDBOX_LINUX_BPF_DSL_TEST_TRAP_REGISTRY_H_ |
| 6 #define SANDBOX_LINUX_BPF_DSL_TEST_TRAP_REGISTRY_H_ | 6 #define SANDBOX_LINUX_BPF_DSL_TEST_TRAP_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/macros.h" | |
| 14 #include "sandbox/linux/bpf_dsl/trap_registry.h" | 13 #include "sandbox/linux/bpf_dsl/trap_registry.h" |
| 15 | 14 |
| 16 namespace sandbox { | 15 namespace sandbox { |
| 17 namespace bpf_dsl { | 16 namespace bpf_dsl { |
| 18 | 17 |
| 19 class TestTrapRegistry : public TrapRegistry { | 18 class TestTrapRegistry : public TrapRegistry { |
| 20 public: | 19 public: |
| 21 TestTrapRegistry(); | 20 TestTrapRegistry(); |
| 22 virtual ~TestTrapRegistry(); | 21 virtual ~TestTrapRegistry(); |
| 23 | 22 |
| 24 uint16_t Add(TrapFnc fnc, const void* aux, bool safe) override; | 23 uint16_t Add(TrapFnc fnc, const void* aux, bool safe) override; |
| 25 bool EnableUnsafeTraps() override; | 24 bool EnableUnsafeTraps() override; |
| 26 | 25 |
| 27 private: | 26 private: |
| 28 using Key = std::pair<TrapFnc, const void*>; | 27 using Key = std::pair<TrapFnc, const void*>; |
| 29 | 28 |
| 30 std::map<Key, uint16_t> map_; | 29 std::map<Key, uint16_t> map_; |
| 31 | 30 |
| 32 DISALLOW_COPY_AND_ASSIGN(TestTrapRegistry); | 31 DISALLOW_COPY_AND_ASSIGN(TestTrapRegistry); |
| 33 }; | 32 }; |
| 34 | 33 |
| 35 } // namespace bpf_dsl | 34 } // namespace bpf_dsl |
| 36 } // namespace sandbox | 35 } // namespace sandbox |
| 37 | 36 |
| 38 #endif // SANDBOX_LINUX_BPF_DSL_TEST_TRAP_REGISTRY_H_ | 37 #endif // SANDBOX_LINUX_BPF_DSL_TEST_TRAP_REGISTRY_H_ |
| OLD | NEW |