Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: tools/ipc_fuzzer/fuzzer/fuzzer.h

Issue 2972773004: Remove ScopedVector from tools/ipc_fuzzer/. (Closed)
Patch Set: rev Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/ipc_fuzzer/fuzzer/fuzzer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 TOOLS_IPC_FUZZER_MUTATE_FUZZER_H_ 5 #ifndef TOOLS_IPC_FUZZER_MUTATE_FUZZER_H_
6 #define TOOLS_IPC_FUZZER_MUTATE_FUZZER_H_ 6 #define TOOLS_IPC_FUZZER_MUTATE_FUZZER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
11 #include <string> 12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "ipc/ipc_message.h" 16 #include "ipc/ipc_message.h"
16 17
17 namespace ipc_fuzzer { 18 namespace ipc_fuzzer {
18 19
19 // Interface implemented by those who generate basic types. The types all 20 // Interface implemented by those who generate basic types. The types all
20 // correspond to the types which a pickle from base/pickle.h can pickle, 21 // correspond to the types which a pickle from base/pickle.h can pickle,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void FuzzInt64(int64_t* value) override {} 61 void FuzzInt64(int64_t* value) override {}
61 void FuzzUInt64(uint64_t* value) override {} 62 void FuzzUInt64(uint64_t* value) override {}
62 void FuzzFloat(float* value) override {} 63 void FuzzFloat(float* value) override {}
63 void FuzzDouble(double* value) override {} 64 void FuzzDouble(double* value) override {}
64 void FuzzString(std::string* value) override {} 65 void FuzzString(std::string* value) override {}
65 void FuzzString16(base::string16* value) override {} 66 void FuzzString16(base::string16* value) override {}
66 void FuzzData(char* data, int length) override {} 67 void FuzzData(char* data, int length) override {}
67 void FuzzBytes(void* data, int data_len) override {} 68 void FuzzBytes(void* data, int data_len) override {}
68 }; 69 };
69 70
70 typedef IPC::Message* (*FuzzerFunction)(IPC::Message*, Fuzzer*); 71 using FuzzerFunction = std::unique_ptr<IPC::Message> (*)(IPC::Message*,
72 Fuzzer*);
71 73
72 // Used for mutating messages. Once populated, the map associates a message ID 74 // Used for mutating messages. Once populated, the map associates a message ID
73 // with a FuzzerFunction used for mutation of that message type. 75 // with a FuzzerFunction used for mutation of that message type.
74 typedef base::hash_map<uint32_t, FuzzerFunction> FuzzerFunctionMap; 76 using FuzzerFunctionMap = base::hash_map<uint32_t, FuzzerFunction>;
75 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map); 77 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map);
76 78
77 // Used for generating new messages. Once populated, the vector contains 79 // Used for generating new messages. Once populated, the vector contains
78 // FuzzerFunctions for all message types that we know how to generate. 80 // FuzzerFunctions for all message types that we know how to generate.
79 typedef std::vector<FuzzerFunction> FuzzerFunctionVector; 81 using FuzzerFunctionVector = std::vector<FuzzerFunction>;
80 void PopulateFuzzerFunctionVector(FuzzerFunctionVector* function_vector); 82 void PopulateFuzzerFunctionVector(FuzzerFunctionVector* function_vector);
81 83
82 // Since IPC::Message can be serialized, we also track a global function vector 84 // Since IPC::Message can be serialized, we also track a global function vector
83 // to handle generation of new messages while fuzzing. 85 // to handle generation of new messages while fuzzing.
84 extern FuzzerFunctionVector g_function_vector; 86 extern FuzzerFunctionVector g_function_vector;
85 87
86 } // namespace ipc_fuzzer 88 } // namespace ipc_fuzzer
87 89
88 #endif // TOOLS_IPC_FUZZER_MUTATE_FUZZER_H_ 90 #endif // TOOLS_IPC_FUZZER_MUTATE_FUZZER_H_
OLDNEW
« no previous file with comments | « no previous file | tools/ipc_fuzzer/fuzzer/fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698