OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include <limits.h> | 5 #include <limits.h> |
| 6 #include <stddef.h> |
| 7 #include <stdint.h> |
6 #include <set> | 8 #include <set> |
7 | 9 |
8 #include "base/files/file.h" | 10 #include "base/files/file.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" |
10 #include "tools/ipc_fuzzer/message_lib/message_file.h" | 13 #include "tools/ipc_fuzzer/message_lib/message_file.h" |
11 #include "tools/ipc_fuzzer/message_lib/message_file_format.h" | 14 #include "tools/ipc_fuzzer/message_lib/message_file_format.h" |
12 #include "tools/ipc_fuzzer/message_lib/message_names.h" | 15 #include "tools/ipc_fuzzer/message_lib/message_names.h" |
13 | 16 |
14 namespace ipc_fuzzer { | 17 namespace ipc_fuzzer { |
15 | 18 |
16 namespace { | 19 namespace { |
17 | 20 |
18 // Helper class to write a MessageVector + message names to a file. | 21 // Helper class to write a MessageVector + message names to a file. |
19 class Writer { | 22 class Writer { |
(...skipping 14 matching lines...) Expand all Loading... |
34 | 37 |
35 bool WriteHeader(); | 38 bool WriteHeader(); |
36 bool WriteMessages(); | 39 bool WriteMessages(); |
37 | 40 |
38 // Each name table entry is a message type + string table offset. | 41 // Each name table entry is a message type + string table offset. |
39 bool WriteNameTable(); | 42 bool WriteNameTable(); |
40 | 43 |
41 // String table contains the actual message names. | 44 // String table contains the actual message names. |
42 bool WriteStringTable(); | 45 bool WriteStringTable(); |
43 | 46 |
44 typedef std::set<uint32> TypesSet; | 47 typedef std::set<uint32_t> TypesSet; |
45 base::FilePath path_; | 48 base::FilePath path_; |
46 base::File file_; | 49 base::File file_; |
47 const MessageVector* messages_; | 50 const MessageVector* messages_; |
48 TypesSet types_; | 51 TypesSet types_; |
49 | 52 |
50 DISALLOW_COPY_AND_ASSIGN(Writer); | 53 DISALLOW_COPY_AND_ASSIGN(Writer); |
51 }; | 54 }; |
52 | 55 |
53 Writer::Writer(const base::FilePath& path) : path_(path), messages_(NULL) { | 56 Writer::Writer(const base::FilePath& path) : path_(path), messages_(NULL) { |
54 } | 57 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 159 |
157 } // namespace | 160 } // namespace |
158 | 161 |
159 bool MessageFile::Write(const base::FilePath& path, | 162 bool MessageFile::Write(const base::FilePath& path, |
160 const MessageVector& messages) { | 163 const MessageVector& messages) { |
161 Writer writer(path); | 164 Writer writer(path); |
162 return writer.Write(messages); | 165 return writer.Write(messages); |
163 } | 166 } |
164 | 167 |
165 } // namespace ipc_fuzzer | 168 } // namespace ipc_fuzzer |
OLD | NEW |