mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
remove uses of folly::hash::fnv32_buf (#39509)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39509 changelog: [internal] Reviewed By: cipolleschi Differential Revision: D49355595 fbshipit-source-id: a75fb91655a7252c4208415940cf9766f750a8ab
This commit is contained in:
committed by
Facebook GitHub Bot
parent
aa03cc0b75
commit
e5b62b5ecd
@@ -10,6 +10,7 @@
|
||||
#include <react/renderer/core/EventLogger.h>
|
||||
#include "NativePerformanceObserver.h"
|
||||
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -298,8 +299,7 @@ void PerformanceEntryReporter::scheduleFlushBuffer() {
|
||||
|
||||
struct StrKey {
|
||||
uint32_t key;
|
||||
StrKey(std::string_view s)
|
||||
: key(folly::hash::fnv32_buf(s.data(), s.length())) {}
|
||||
StrKey(std::string_view s) : key(std::hash<std::string_view>{}(s)) {}
|
||||
|
||||
bool operator==(const StrKey& rhs) const {
|
||||
return key == rhs.key;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <react/renderer/core/RawPropsPrimitives.h>
|
||||
#include <functional>
|
||||
|
||||
// We need to use clang pragmas inside of a macro below,
|
||||
// so we need to pull out the "if" statement here.
|
||||
@@ -26,7 +27,7 @@
|
||||
CLANG_PRAGMA("clang diagnostic pop") \
|
||||
}())
|
||||
|
||||
#define RAW_PROPS_KEY_HASH(s) folly::hash::fnv32_buf(s, std::strlen(s))
|
||||
#define RAW_PROPS_KEY_HASH(s) std::hash<std::string>{}(s)
|
||||
|
||||
// Convenience for building setProps switch statements.
|
||||
// This injects `fromRawValue` into source; each file that uses
|
||||
|
||||
@@ -198,7 +198,7 @@ void RawPropsParser::iterateOverValues(
|
||||
|
||||
auto name = nameValue.utf8(runtime);
|
||||
|
||||
auto nameHash = RAW_PROPS_KEY_HASH(name.c_str());
|
||||
auto nameHash = RAW_PROPS_KEY_HASH(name);
|
||||
auto rawValue = RawValue(jsi::dynamicFromValue(runtime, value));
|
||||
|
||||
visit(nameHash, name.c_str(), rawValue);
|
||||
@@ -213,7 +213,7 @@ void RawPropsParser::iterateOverValues(
|
||||
for (const auto& pair : dynamic.items()) {
|
||||
auto name = pair.first.getString();
|
||||
|
||||
auto nameHash = RAW_PROPS_KEY_HASH(name.c_str());
|
||||
auto nameHash = RAW_PROPS_KEY_HASH(name);
|
||||
auto rawValue = RawValue{pair.second};
|
||||
visit(nameHash, name.c_str(), rawValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user