| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TRAP_REGISTRY_H_ | 5 #ifndef SANDBOX_LINUX_BPF_DSL_TRAP_REGISTRY_H_ |
| 6 #define SANDBOX_LINUX_BPF_DSL_TRAP_REGISTRY_H_ | 6 #define SANDBOX_LINUX_BPF_DSL_TRAP_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // time of the trap registry. If the same tuple is registered | 46 // time of the trap registry. If the same tuple is registered |
| 47 // multiple times, the same value will be returned each time. | 47 // multiple times, the same value will be returned each time. |
| 48 virtual uint16_t Add(TrapFnc fnc, const void* aux, bool safe) = 0; | 48 virtual uint16_t Add(TrapFnc fnc, const void* aux, bool safe) = 0; |
| 49 | 49 |
| 50 // EnableUnsafeTraps tries to enable unsafe traps and returns | 50 // EnableUnsafeTraps tries to enable unsafe traps and returns |
| 51 // whether it was successful. This is a one-way operation. | 51 // whether it was successful. This is a one-way operation. |
| 52 virtual bool EnableUnsafeTraps() = 0; | 52 virtual bool EnableUnsafeTraps() = 0; |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 TrapRegistry() {} | 55 TrapRegistry() {} |
| 56 | |
| 57 // TrapRegistry's destructor is intentionally non-virtual so that | |
| 58 // implementations can omit their destructor. Instead we protect against | |
| 59 // misuse by marking it protected. | |
| 60 ~TrapRegistry() {} | 56 ~TrapRegistry() {} |
| 61 | 57 |
| 62 DISALLOW_COPY_AND_ASSIGN(TrapRegistry); | 58 DISALLOW_COPY_AND_ASSIGN(TrapRegistry); |
| 63 }; | 59 }; |
| 64 | 60 |
| 65 } // namespace bpf_dsl | 61 } // namespace bpf_dsl |
| 66 } // namespace sandbox | 62 } // namespace sandbox |
| 67 | 63 |
| 68 #endif // SANDBOX_LINUX_BPF_DSL_TRAP_REGISTRY_H_ | 64 #endif // SANDBOX_LINUX_BPF_DSL_TRAP_REGISTRY_H_ |
| OLD | NEW |