mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: ComponentName is used by many core component of React Native, such as ComponentDescriptor, ShadowNode, ShadowView and so on. In all those cases this value represents the actual name of the component which came from `concreteComponentName` template parameter of ConcreteShadowNode. In all of those cases, it's raw `char const *` type. So, we don't need to use owning representation of the string (std::string) in all those places. The only exception from this is a part where we receive the name of the component from JS side. In this case, the source string comes from JS and has to be analyzed as a character sequence to find corresponding ComponentDescriptor. In my experiments, 20% of the time during diffing is spent on copying (this) `std::string`. Reviewed By: mdvacca Differential Revision: D15844407 fbshipit-source-id: a2e71505e22d09107e001bdf661d4a826bcf2dea
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <folly/dynamic.h>
|
|
#include <react/core/RawProps.h>
|
|
#include <react/core/RawValue.h>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
/*
|
|
* `Tag` and `InstanceHandle` are used to address React Native components.
|
|
*/
|
|
using Tag = int32_t;
|
|
using InstanceHandle = struct InstanceHandleDummyStruct {
|
|
} *;
|
|
|
|
/*
|
|
* An id of a running Surface instance that is used to refer to the instance.
|
|
*/
|
|
using SurfaceId = int32_t;
|
|
|
|
/*
|
|
* Universal component handle which allows to refer to `ComponentDescriptor`s
|
|
* in maps efficiently.
|
|
* Practically, it's something that concrete ShadowNode and concrete
|
|
* ComponentDescriptor have in common.
|
|
*/
|
|
using ComponentHandle = int64_t;
|
|
|
|
/*
|
|
* String identifier for components used for addressing them from
|
|
* JavaScript side.
|
|
*/
|
|
using ComponentName = char const *;
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|