Skip to content

Commit

Permalink
Mark subclasses of ShadowNode final when appropriate
Browse files Browse the repository at this point in the history
Summary:
Changelog: [internal]

These ShadowNode subclasses should not be further subclassed. compiler can produce smaller and faster code.

Reviewed By: JoshuaGross

Differential Revision: D27463255

fbshipit-source-id: cb10cc61a3d80731476ac0c51af7f9a47e3f9ab7
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Mar 31, 2021
1 parent faec9cd commit 1e690ac
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
12 changes: 6 additions & 6 deletions ReactCommon/react/renderer/components/text/ParagraphShadowNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ extern char const ParagraphComponentName[];
* containing and displaying text. Text content is represented as nested <Text>
* and <RawText> components.
*/
class ParagraphShadowNode : public ConcreteViewShadowNode<
ParagraphComponentName,
ParagraphProps,
ParagraphEventEmitter,
ParagraphState>,
public BaseTextShadowNode {
class ParagraphShadowNode final : public ConcreteViewShadowNode<
ParagraphComponentName,
ParagraphProps,
ParagraphEventEmitter,
ParagraphState>,
public BaseTextShadowNode {
public:
using ConcreteViewShadowNode::ConcreteViewShadowNode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ extern const char AndroidTextInputComponentName[];
/*
* `ShadowNode` for <AndroidTextInput> component.
*/
class AndroidTextInputShadowNode : public ConcreteViewShadowNode<
AndroidTextInputComponentName,
AndroidTextInputProps,
AndroidTextInputEventEmitter,
AndroidTextInputState> {
class AndroidTextInputShadowNode final : public ConcreteViewShadowNode<
AndroidTextInputComponentName,
AndroidTextInputProps,
AndroidTextInputEventEmitter,
AndroidTextInputState> {
public:
static ShadowNodeTraits BaseTraits() {
auto traits = ConcreteViewShadowNode::BaseTraits();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ extern const char TextInputComponentName[];
/*
* `ShadowNode` for <TextInput> component.
*/
class TextInputShadowNode : public ConcreteViewShadowNode<
TextInputComponentName,
TextInputProps,
TextInputEventEmitter,
TextInputState>,
public BaseTextShadowNode {
class TextInputShadowNode final : public ConcreteViewShadowNode<
TextInputComponentName,
TextInputProps,
TextInputEventEmitter,
TextInputState>,
public BaseTextShadowNode {
public:
using ConcreteViewShadowNode::ConcreteViewShadowNode;

Expand Down
10 changes: 5 additions & 5 deletions ReactCommon/react/renderer/core/tests/TestComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class TestShadowNode;

using SharedTestShadowNode = std::shared_ptr<const TestShadowNode>;

class TestShadowNode : public ConcreteViewShadowNode<
TestComponentName,
TestProps,
ViewEventEmitter,
TestState> {
class TestShadowNode final : public ConcreteViewShadowNode<
TestComponentName,
TestProps,
ViewEventEmitter,
TestState> {
public:
using ConcreteViewShadowNode::ConcreteViewShadowNode;

Expand Down

0 comments on commit 1e690ac

Please sign in to comment.