mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Use absl::NoDestructor for static flat_hash_map
PiperOrigin-RevId: 671853605
This commit is contained in:
committed by
Copybara-Service
parent
e36398b124
commit
b15cbddb8b
@@ -34,6 +34,7 @@ cc_library(
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"@com_google_absl//absl/base:no_destructor",
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:span",
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/base/no_destructor.h"
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
#include "absl/strings/ascii.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
@@ -27,10 +28,9 @@ namespace utils {
|
||||
// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types.
|
||||
std::string GetWellKnownMimeTypeFromExtension(absl::string_view extension) {
|
||||
// The extension types in this map must be lower case.
|
||||
static absl::flat_hash_map<
|
||||
static absl::NoDestructor<absl::flat_hash_map<
|
||||
std::string,
|
||||
std::string>* mime_map = new absl::flat_hash_map<std::string,
|
||||
std::string>({
|
||||
std::string>> mime_map({
|
||||
{"123", "application/vnd.lotus-1-2-3"},
|
||||
{"3dml", "text/vnd.in3d.3dml"},
|
||||
{"3ds", "image/x-3ds"},
|
||||
|
||||
Reference in New Issue
Block a user