Revert D49355595: remove uses of folly::hash::fnv32_buf

Differential Revision:
D49355595

Original commit changeset: a75fb91655a7

Original Phabricator Diff: D49355595

fbshipit-source-id: a1a32b869e1539ce931a6b9957e3697e7db72d2a
This commit is contained in:
Willa Kong
2023-09-22 11:19:56 -07:00
committed by Facebook GitHub Bot
parent 0d63a15857
commit 2fb4547aa0
3 changed files with 5 additions and 6 deletions
@@ -10,7 +10,6 @@
#include <react/renderer/core/EventLogger.h>
#include "NativePerformanceObserver.h"
#include <functional>
#include <unordered_map>
namespace facebook::react {
@@ -299,7 +298,8 @@ void PerformanceEntryReporter::scheduleFlushBuffer() {
struct StrKey {
uint32_t key;
StrKey(std::string_view s) : key(std::hash<std::string_view>{}(s)) {}
StrKey(std::string_view s)
: key(folly::hash::fnv32_buf(s.data(), s.length())) {}
bool operator==(const StrKey& rhs) const {
return key == rhs.key;
@@ -8,7 +8,6 @@
#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.
@@ -27,7 +26,7 @@
CLANG_PRAGMA("clang diagnostic pop") \
}())
#define RAW_PROPS_KEY_HASH(s) std::hash<std::string>{}(s)
#define RAW_PROPS_KEY_HASH(s) folly::hash::fnv32_buf(s, std::strlen(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);
auto nameHash = RAW_PROPS_KEY_HASH(name.c_str());
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);
auto nameHash = RAW_PROPS_KEY_HASH(name.c_str());
auto rawValue = RawValue{pair.second};
visit(nameHash, name.c_str(), rawValue);
}