Backed out 2 changesets (bug 1943998) for causing wd failures @ phases.py CLOSED...
[gecko.git] / tools / fuzzing / nyx / Nyx.h
blob0489b2088e21e22e4cdd9ab0246a6bcd45ad8ec3
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_fuzzing_Nyx_h
8 #define mozilla_fuzzing_Nyx_h
10 #include <stdint.h>
11 #include <atomic>
12 #include <list>
14 #ifndef NYX_DISALLOW_COPY_AND_ASSIGN
15 # define NYX_DISALLOW_COPY_AND_ASSIGN(T) \
16 T(const T&); \
17 void operator=(const T&)
18 #endif
20 namespace mozilla {
22 class MallocAllocPolicy;
23 template <class T, size_t MinInlineCapacity, class AllocPolicy>
24 class Vector;
26 namespace fuzzing {
28 class Nyx {
29 public:
30 static Nyx& instance();
32 void start(void);
33 bool started(void);
34 bool is_enabled(const char* identifier);
35 bool is_replay();
36 uint32_t get_data(uint8_t* data, uint32_t size);
37 uint32_t get_raw_data(uint8_t* data, uint32_t size);
38 void release(uint32_t iterations = 1);
39 void handle_event(const char* type, const char* file, int line,
40 const char* reason);
41 void dump_file(void* buffer, size_t len, const char* filename);
43 private:
44 std::atomic<bool> mInited;
46 std::atomic<bool> mReplayMode;
47 std::list<Vector<uint8_t, 0, MallocAllocPolicy>*> mReplayBuffers;
48 Vector<uint8_t, 0, MallocAllocPolicy>* mRawReplayBuffer;
50 Nyx();
51 NYX_DISALLOW_COPY_AND_ASSIGN(Nyx);
54 } // namespace fuzzing
55 } // namespace mozilla
57 #endif /* mozilla_fuzzing_Nyx_h */