mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36: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"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"@com_google_absl//absl/base:no_destructor",
|
||||||
"@com_google_absl//absl/container:flat_hash_map",
|
"@com_google_absl//absl/container:flat_hash_map",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
"@com_google_absl//absl/types:span",
|
"@com_google_absl//absl/types:span",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "absl/base/no_destructor.h"
|
||||||
#include "absl/container/flat_hash_map.h"
|
#include "absl/container/flat_hash_map.h"
|
||||||
#include "absl/strings/ascii.h"
|
#include "absl/strings/ascii.h"
|
||||||
#include "absl/strings/string_view.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.
|
// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types.
|
||||||
std::string GetWellKnownMimeTypeFromExtension(absl::string_view extension) {
|
std::string GetWellKnownMimeTypeFromExtension(absl::string_view extension) {
|
||||||
// The extension types in this map must be lower case.
|
// 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,
|
||||||
std::string>* mime_map = new absl::flat_hash_map<std::string,
|
std::string>> mime_map({
|
||||||
std::string>({
|
|
||||||
{"123", "application/vnd.lotus-1-2-3"},
|
{"123", "application/vnd.lotus-1-2-3"},
|
||||||
{"3dml", "text/vnd.in3d.3dml"},
|
{"3dml", "text/vnd.in3d.3dml"},
|
||||||
{"3ds", "image/x-3ds"},
|
{"3ds", "image/x-3ds"},
|
||||||
|
|||||||
Reference in New Issue
Block a user