Consolidate various debug-only flags into flags.h (#30988)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/30988

We have a bunch of flags scattered throughout the codebase with poor hygiene and commenting. Consolidate.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26392518

fbshipit-source-id: 2823de123a5009d6b8c358e8a3f451b9fa0e05b7
This commit is contained in:
Joshua Gross
2021-02-17 18:00:47 -08:00
committed by Facebook GitHub Bot
parent 528d51e583
commit fb1833eede
11 changed files with 56 additions and 39 deletions
@@ -8,6 +8,7 @@
#pragma once
#include <react/renderer/core/EventTarget.h>
#include <react/renderer/debug/flags.h>
#include <react/renderer/mounting/Differentiator.h>
#include <react/renderer/mounting/MountingCoordinator.h>
#include <react/renderer/mounting/MountingOverrideDelegate.h>
@@ -27,10 +27,6 @@
#include <glog/logging.h>
// Uncomment to enable verbose LayoutAnimation debug asserts, especially useful
// for Android
//#define VERBOSE_LAYOUT_ANIMATION_ASSERTS 1
#ifdef VERBOSE_LAYOUT_ANIMATION_ASSERTS
#define LA_ASSERT(cond) \
if (!(cond)) { \
@@ -7,16 +7,11 @@
#pragma once
// Enable some or all of these to enable very verbose logging for
// LayoutAnimations
//#define LAYOUT_ANIMATION_VERBOSE_LOGGING 1
//#define RN_SHADOW_TREE_INTROSPECTION
//#define RN_DEBUG_STRING_CONVERTIBLE 1
#include <ReactCommon/RuntimeExecutor.h>
#include <better/optional.h>
#include <react/renderer/core/EventTarget.h>
#include <react/renderer/core/RawValue.h>
#include <react/renderer/debug/flags.h>
#include <react/renderer/mounting/Differentiator.h>
#include <react/renderer/mounting/MountingCoordinator.h>
#include <react/renderer/mounting/MountingOverrideDelegate.h>
@@ -13,25 +13,11 @@
#include <unordered_set>
#include <vector>
#include "flags.h"
namespace facebook {
namespace react {
#ifndef NDEBUG
#define RN_DEBUG_STRING_CONVERTIBLE 1
#endif
// To Debug Yoga layout, uncomment the following line.
// #define RN_DEBUG_YOGA_LOGGER 1
//
// Additional logging can be enabled editing yoga.cpp (e.g. gPrintChanges,
// gPrintSkips)
// To Debug introspection of RN Shadow tree, uncomment the following line:
// #define RN_SHADOW_TREE_INTROSPECTION 1
// To enable asserts (crashing) when checking stub trees
// #define RN_VALIDATE_SHADOW_TREE_STUB 1
#if RN_DEBUG_STRING_CONVERTIBLE
class DebugStringConvertible;
+48
View File
@@ -0,0 +1,48 @@
/*
* 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
//
// This file contains flags that should __never__ be enabled for
// release-mode/production builds, unless explicitly noted. You can enable some
// of these for debug or local builds to assist in logging / debugging specific
// features.
//
// Enables verbose logging for the LayoutAnimations subsystem.
//#define LAYOUT_ANIMATION_VERBOSE_LOGGING 1
// Logs information before running `assert` in LayoutAnimations. More useful on
// Android vs other platforms.
//#define VERBOSE_LAYOUT_ANIMATION_ASSERTS 1
// Enables some Shadow Tree introspection features (maintains a StubViewTree,
// and logs prev/next tree and mutations if there are any discrepancies). If you
// define this, also define `RN_DEBUG_STRING_CONVERTIBLE`.
#ifndef NDEBUG
#define RN_SHADOW_TREE_INTROSPECTION 1
#endif
// This enables certain object-to-string debug conversions to be compiled.
// Enable if `RN_SHADOW_TREE_INTROSPECTION` is enabled.
#ifdef RN_SHADOW_TREE_INTROSPECTION
#define RN_DEBUG_STRING_CONVERTIBLE 1
#endif
// Enables *very* verbose, noisy logs in the differ. Useful for debugging
// specifically the differ, but not much else.
//#define DEBUG_LOGS_DIFFER
// Uncomment to enable verbose StubViewTree debug logs. This ensures that errors
// are logged to console before the `assert` is fired. More useful on Android vs
// other platforms.
//#define STUB_VIEW_TREE_VERBOSE 1
// Verbose logging for certain Yoga-related things in the RN codebase (not Yoga
// codebase). Useful for debugging layout.
//#define RN_DEBUG_YOGA_LOGGER 1
@@ -14,10 +14,6 @@
#include <algorithm>
#include "ShadowView.h"
// Uncomment this to enable verbose diffing logs, which can be useful for
// debugging.
// #define DEBUG_LOGS_DIFFER
#ifdef DEBUG_LOGS_DIFFER
#include <glog/logging.h>
#define DEBUG_LOGS(code) code
@@ -8,6 +8,7 @@
#pragma once
#include <react/renderer/core/ShadowNode.h>
#include <react/renderer/debug/flags.h>
#include <react/renderer/mounting/ShadowViewMutation.h>
namespace facebook {
@@ -10,6 +10,7 @@
#include <better/optional.h>
#include <chrono>
#include <react/renderer/debug/flags.h>
#include <react/renderer/mounting/Differentiator.h>
#include <react/renderer/mounting/MountingOverrideDelegate.h>
#include <react/renderer/mounting/MountingTransaction.h>
@@ -17,10 +18,6 @@
#include <react/renderer/mounting/TelemetryController.h>
#include "ShadowTreeRevision.h"
#ifndef NDEBUG
#define RN_SHADOW_TREE_INTROSPECTION 1
#endif
#ifdef RN_SHADOW_TREE_INTROSPECTION
#include <react/renderer/mounting/stubs.h>
#endif
@@ -9,9 +9,6 @@
#include <glog/logging.h>
// Uncomment to enable verbose StubViewTree debug logs
// #define STUB_VIEW_TREE_VERBOSE 1
// For iOS especially: flush logs because some might be lost on iOS if an
// assert is hit right after this.
#define STUB_VIEW_ASSERT(cond) \
+1 -1
View File
@@ -1,4 +1,4 @@
# Gemfile
source 'https://rubygems.org'
gem 'cocoapods', '= 1.10.0'
gem 'cocoapods', '= 1.10.1'
+1 -1
View File
@@ -841,4 +841,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 799678aa4c11e7c6d8a431a3883e94b09b8dd0f1
COCOAPODS: 1.10.0
COCOAPODS: 1.10.1