OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef Fuzz_DEFINED | 8 #ifndef Fuzz_DEFINED |
9 #define Fuzz_DEFINED | 9 #define Fuzz_DEFINED |
10 | 10 |
11 #include "SkData.h" | 11 #include "SkData.h" |
12 #include "SkTRegistry.h" | 12 #include "SkTRegistry.h" |
13 #include "SkTypes.h" | 13 #include "SkTypes.h" |
14 | 14 |
15 class Fuzz : SkNoncopyable { | 15 class Fuzz : SkNoncopyable { |
16 public: | 16 public: |
17 explicit Fuzz(SkData*); | 17 explicit Fuzz(sk_sp<SkData>); |
18 | 18 |
19 // Returns the total number of "random" bytes available. | 19 // Returns the total number of "random" bytes available. |
20 size_t size(); | 20 size_t size(); |
21 // Returns the total number of "random" bytes remaining for randomness. | 21 // Returns the total number of "random" bytes remaining for randomness. |
22 size_t remaining(); | 22 size_t remaining(); |
23 | 23 |
24 template <typename T> | 24 template <typename T> |
25 bool next(T* n); | 25 bool next(T* n); |
26 | 26 |
27 bool nextBool(); | 27 bool nextBool(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 const char* name; | 66 const char* name; |
67 void (*fn)(Fuzz*); | 67 void (*fn)(Fuzz*); |
68 }; | 68 }; |
69 | 69 |
70 #define DEF_FUZZ(name, f) \ | 70 #define DEF_FUZZ(name, f) \ |
71 static void fuzz_##name(Fuzz*); \ | 71 static void fuzz_##name(Fuzz*); \ |
72 SkTRegistry<Fuzzable> register_##name({#name, fuzz_##name}); \ | 72 SkTRegistry<Fuzzable> register_##name({#name, fuzz_##name}); \ |
73 static void fuzz_##name(Fuzz* f) | 73 static void fuzz_##name(Fuzz* f) |
74 | 74 |
75 #endif//Fuzz_DEFINED | 75 #endif//Fuzz_DEFINED |
OLD | NEW |