File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ cc_library(
4747 deps = [
4848 ":engine_interface" ,
4949 ":engine_settings" ,
50- "@com_google_absl//absl/container:flat_hash_map" ,
5150 "@com_google_absl//absl/functional:any_invocable" ,
5251 "@com_google_absl//absl/log:absl_log" ,
5352 "@com_google_absl//absl/status" ,
Original file line number Diff line number Diff line change 1818#include < cstddef>
1919#include < memory>
2020#include < string>
21+ #include < unordered_map>
2122#include < utility>
2223#include < vector>
2324
24- #include " absl/container/flat_hash_map.h" // from @com_google_absl
2525#include " absl/functional/any_invocable.h" // from @com_google_absl
2626#include " absl/log/absl_log.h" // from @com_google_absl
2727#include " absl/status/status.h" // from @com_google_absl
@@ -209,10 +209,17 @@ class EngineFactory {
209209 }},
210210 }) {}
211211
212- absl::flat_hash_map<EngineType, Creator> registry_;
212+ // Use std::unordered_map instead of absl::flat_hash_map to avoid Windows
213+ // build/linker issues across DLL boundaries (see cl/403158423 and
214+ // b/508692203). std::unordered_map can also be faster when the number of
215+ // elements is low.
216+ std::unordered_map<EngineType, Creator> registry_;
217+
213218 // Map of preferred engine types for each backend. The first available
214219 // (registered) engine type in the list will be selected by CreateDefault().
215- absl::flat_hash_map<Backend, std::vector<EngineType>> preferred_engines_;
220+ // Use std::unordered_map for consistency with registry_ and to avoid similar
221+ // Windows issues.
222+ std::unordered_map<Backend, std::vector<EngineType>> preferred_engines_;
216223};
217224
218225// Helper struct to register an engine type with the EngineFactory.
You can’t perform that action at this time.
0 commit comments