mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 07:35:25 +00:00
Summary: This diff changes how we expose UIManager to JavaScript realm and control ownership of it. This change should improve reliability and a thread-safety. UIManagerBinding is a HostObject which consolidate ownership of UIManager. Now JavaScript's GC controls its lifetime which eliminates the possibility of calling some JS facing methods of UIManager using a dangling pointer. Besides that, all API now imply that if the caller has a reference to jsi::Runtime, it calls the method on the proper thread (it's an implication of RuntimeExecutor design). Reviewed By: sahrens Differential Revision: D12876745 fbshipit-source-id: eb8c70317460df5b14e45031ad15fc6c8e5b5ce3
42 lines
1.2 KiB
C++
42 lines
1.2 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 <fabric/core/LocalData.h>
|
|
#include <fabric/core/Props.h>
|
|
#include <fabric/core/ReactPrimitives.h>
|
|
#include <fabric/core/ShadowNode.h>
|
|
#include <fabric/events/EventEmitter.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
/*
|
|
* An object which supposed to be used as a parameter specifying a shape
|
|
* of created or cloned ShadowNode.
|
|
* Note: Most of the fields are `const &` references (essentially just raw
|
|
* pointers) which means that the Fragment does not copy/store them or
|
|
* retain ownership of them.
|
|
*/
|
|
struct ShadowNodeFragment {
|
|
Tag tag = 0;
|
|
Tag rootTag = 0;
|
|
const SharedProps &props = nullSharedProps();
|
|
const SharedEventEmitter &eventEmitter = nullSharedEventEmitter();
|
|
const SharedShadowNodeSharedList &children = nullSharedChildren();
|
|
const SharedLocalData &localData = nullLocalData();
|
|
|
|
static SharedProps &nullSharedProps();
|
|
static SharedEventEmitter &nullSharedEventEmitter();
|
|
static SharedShadowNodeSharedList &nullSharedChildren();
|
|
static SharedLocalData &nullLocalData();
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|