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

Side by Side Diff: tools/ipc_fuzzer/message_lib/message_names.h

Issue 2214713003: Make message_names.cc build 10-30x faster. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef TOOLS_IPC_FUZZER_MESSAGE_LIB_MESSAGE_NAMES_H_ 5 #ifndef TOOLS_IPC_FUZZER_MESSAGE_LIB_MESSAGE_NAMES_H_
6 #define TOOLS_IPC_FUZZER_MESSAGE_LIB_MESSAGE_NAMES_H_ 6 #define TOOLS_IPC_FUZZER_MESSAGE_LIB_MESSAGE_NAMES_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map>
11 #include <string> 10 #include <string>
11 #include <unordered_map>
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 14
15 namespace ipc_fuzzer { 15 namespace ipc_fuzzer {
16 16
17 class MessageNames { 17 class MessageNames {
18 public: 18 public:
19 MessageNames(); 19 MessageNames();
20 ~MessageNames(); 20 ~MessageNames();
21 static MessageNames* GetInstance(); 21 static MessageNames* GetInstance();
(...skipping 17 matching lines...) Expand all
39 return it->second; 39 return it->second;
40 } 40 }
41 41
42 uint32_t NameToType(const std::string& name) { 42 uint32_t NameToType(const std::string& name) {
43 NameToTypeMap::iterator it = type_map_.find(name); 43 NameToTypeMap::iterator it = type_map_.find(name);
44 CHECK(it != type_map_.end()); 44 CHECK(it != type_map_.end());
45 return it->second; 45 return it->second;
46 } 46 }
47 47
48 private: 48 private:
49 typedef std::map<uint32_t, std::string> TypeToNameMap; 49 typedef std::unordered_map<uint32_t, std::string> TypeToNameMap;
50 typedef std::map<std::string, uint32_t> NameToTypeMap; 50 typedef std::unordered_map<std::string, uint32_t> NameToTypeMap;
51 TypeToNameMap name_map_; 51 TypeToNameMap name_map_;
52 NameToTypeMap type_map_; 52 NameToTypeMap type_map_;
53 53
54 static MessageNames* all_names_; 54 static MessageNames* all_names_;
55 55
56 DISALLOW_COPY_AND_ASSIGN(MessageNames); 56 DISALLOW_COPY_AND_ASSIGN(MessageNames);
57 }; 57 };
58 58
59 } // namespace ipc_fuzzer 59 } // namespace ipc_fuzzer
60 60
61 #endif // TOOLS_IPC_FUZZER_MESSAGE_LIB_MESSAGE_NAMES_H_ 61 #endif // TOOLS_IPC_FUZZER_MESSAGE_LIB_MESSAGE_NAMES_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698