mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Unbreak RN_SHADOW_TREE_INTROSPECTION flag (#46589)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46589 This is a useful too for debugging ShadowTree mutations, but was broken due to some recent build changes. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D63099720 fbshipit-source-id: 9ae5ee062ef9a6a99b2517e4eedd286cd6259fbe
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9235be3776
commit
9eafec48f3
@@ -12,6 +12,7 @@
|
||||
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
||||
#include <react/renderer/core/LayoutableShadowNode.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "ShadowView.h"
|
||||
|
||||
#ifdef DEBUG_LOGS_DIFFER
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
*/
|
||||
|
||||
#include "MountingCoordinator.h"
|
||||
|
||||
#include <cxxreact/SystraceSection.h>
|
||||
#include <react/debug/react_native_assert.h>
|
||||
#include <react/renderer/mounting/ShadowViewMutation.h>
|
||||
#include <condition_variable>
|
||||
#include "updateMountedFlag.h"
|
||||
|
||||
#ifdef RN_SHADOW_TREE_INTROSPECTION
|
||||
@@ -13,12 +18,6 @@
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#include <condition_variable>
|
||||
|
||||
#include <cxxreact/SystraceSection.h>
|
||||
#include <react/debug/react_native_assert.h>
|
||||
#include <react/renderer/mounting/ShadowViewMutation.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
MountingCoordinator::MountingCoordinator(const ShadowTreeRevision& baseRevision)
|
||||
@@ -104,6 +103,9 @@ std::optional<MountingTransaction> MountingCoordinator::pullTransaction(
|
||||
}
|
||||
|
||||
// Override case
|
||||
#ifdef RN_SHADOW_TREE_INTROSPECTION
|
||||
bool didOverridePullTransaction = false;
|
||||
#endif
|
||||
for (const auto& delegate : mountingOverrideDelegates_) {
|
||||
auto mountingOverrideDelegate = delegate.lock();
|
||||
auto shouldOverridePullTransaction = mountingOverrideDelegate &&
|
||||
@@ -130,6 +132,9 @@ std::optional<MountingTransaction> MountingCoordinator::pullTransaction(
|
||||
|
||||
transaction = mountingOverrideDelegate->pullTransaction(
|
||||
surfaceId_, number_, telemetry, std::move(mutations));
|
||||
#ifdef RN_SHADOW_TREE_INTROSPECTION
|
||||
didOverridePullTransaction = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +153,7 @@ std::optional<MountingTransaction> MountingCoordinator::pullTransaction(
|
||||
// If the transaction was overridden, we don't have a model of the shadow
|
||||
// tree therefore we cannot validate the validity of the mutation
|
||||
// instructions.
|
||||
if (!shouldOverridePullTransaction && lastRevision_.has_value()) {
|
||||
if (!didOverridePullTransaction && lastRevision_.has_value()) {
|
||||
auto stubViewTree = buildStubViewTreeWithoutUsingDifferentiator(
|
||||
*lastRevision_->rootShadowNode);
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <react/renderer/mounting/MountingTransaction.h>
|
||||
#include <react/renderer/mounting/ShadowTreeRevision.h>
|
||||
#include <react/renderer/mounting/TelemetryController.h>
|
||||
#include "ShadowTreeRevision.h"
|
||||
|
||||
#ifdef RN_SHADOW_TREE_INTROSPECTION
|
||||
#include <react/renderer/mounting/stubs/stubs.h>
|
||||
|
||||
@@ -257,9 +257,9 @@ void StubViewTree::mutate(const ShadowViewMutationList& mutations) {
|
||||
google::FlushLogFiles(google::GLOG_INFO);
|
||||
}
|
||||
|
||||
std::ostream& StubViewTree::dumpTags(std::ostream& stream) {
|
||||
std::ostream& StubViewTree::dumpTags(std::ostream& stream) const {
|
||||
for (const auto& pair : registry_) {
|
||||
auto& stubView = *registry_.at(pair.first);
|
||||
auto& stubView = *pair.second;
|
||||
stream << "[" << stubView.tag << "]##"
|
||||
<< std::hash<ShadowView>{}((ShadowView)stubView) << " ";
|
||||
}
|
||||
@@ -273,10 +273,10 @@ bool operator==(const StubViewTree& lhs, const StubViewTree& rhs) {
|
||||
<< lhs.registry_.size() << " RHS: " << rhs.registry_.size();
|
||||
|
||||
LOG(ERROR) << "Tags in LHS: ";
|
||||
lhs.dumpTagsHash(LOG(ERROR));
|
||||
lhs.dumpTags(LOG(ERROR));
|
||||
|
||||
LOG(ERROR) << "Tags in RHS: ";
|
||||
rhs.dumpTagsHash(LOG(ERROR));
|
||||
rhs.dumpTags(LOG(ERROR));
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
@@ -41,7 +41,7 @@ class StubViewTree {
|
||||
friend bool operator==(const StubViewTree& lhs, const StubViewTree& rhs);
|
||||
friend bool operator!=(const StubViewTree& lhs, const StubViewTree& rhs);
|
||||
|
||||
std::ostream& dumpTags(std::ostream& stream);
|
||||
std::ostream& dumpTags(std::ostream& stream) const;
|
||||
|
||||
bool hasTag(Tag tag) const {
|
||||
return registry_.find(tag) != registry_.end();
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <react/renderer/core/ShadowNode.h>
|
||||
#include "StubView.h"
|
||||
#include "StubViewTree.h"
|
||||
#include <react/renderer/mounting/stubs/StubView.h>
|
||||
#include <react/renderer/mounting/stubs/StubViewTree.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
|
||||
@@ -22,11 +22,6 @@
|
||||
#include <react/renderer/uimanager/UIManager.h>
|
||||
#include <react/renderer/uimanager/UIManagerBinding.h>
|
||||
|
||||
#ifdef RN_SHADOW_TREE_INTROSPECTION
|
||||
#include <react/renderer/mounting/stubs.h>
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
Scheduler::Scheduler(
|
||||
|
||||
Reference in New Issue
Block a user