react-native/ReactCommon/fabric/core/shadownode/ShadowNodeFragment.cpp
Valentin Shergin 3770d4df45 Fabric: Using const & type for ShadowNodeFragment's fields
Summary:
@public
To avoid unnecessary copying of `shared_ptr`s inside ShadowNodeFragment, now we store them as `const &` references.

Reviewed By: mdvacca

Differential Revision: D8988388

fbshipit-source-id: 0b3582e57ce7577b8fa819392bf33f34e1a60b59
2018-08-04 09:47:31 -07:00

35 lines
846 B
C++

/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "ShadowNodeFragment.h"
namespace facebook {
namespace react {
SharedProps &ShadowNodeFragment::nullSharedProps() {
static auto &instance = *new SharedProps();
return instance;
}
SharedEventEmitter &ShadowNodeFragment::nullSharedEventEmitter() {
static auto &instance = *new SharedEventEmitter();
return instance;
}
SharedShadowNodeSharedList &ShadowNodeFragment::nullSharedChildren() {
static auto &instance = *new SharedShadowNodeSharedList();
return instance;
}
SharedLocalData &ShadowNodeFragment::nullLocalData() {
static auto &instance = *new SharedLocalData();
return instance;
}
} // namespace react
} // namespace facebook