mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Unify SystraceSection.h implementation (#35353)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35353 Unfortunately we have 2 different definitions of SystraceSection.h - xplat/js/react-native-github/ReactCommon/cxxreact/SystraceSection.h - xplat/js/react-native-github/ReactCommon/react/renderer/debug/SystraceSection.h The first one is the Old Arch one and the second one is the New Arch one. As we first step, we unify the implementation Changelog: [Internal] Reviewed By: rshest Differential Revision: D41307049 fbshipit-source-id: a9eb854dfcf49f87ad81fd9cc8dbe51648ecd209
This commit is contained in:
committed by
Facebook GitHub Bot
parent
67b8e182fa
commit
1ec1785e32
@@ -14,6 +14,16 @@
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
/**
|
||||
* Allow providing an fbsystrace implementation that can short-circuit out
|
||||
* quickly and can throttle too frequent events so we can get useful traces even
|
||||
* if rendering etc. is spinning. For throttling we'll need file/line info so we
|
||||
* use a macro.
|
||||
*/
|
||||
#if defined(WITH_LOOM_TRACE)
|
||||
#define SystraceSection \
|
||||
static constexpr const char systraceSectionFile[] = __FILE__; \
|
||||
fbsystrace::FbSystraceSection<systraceSectionFile, __LINE__>
|
||||
/**
|
||||
* This is a convenience class to avoid lots of verbose profiling
|
||||
* #ifdefs. If WITH_FBSYSTRACE is not defined, the optimizer will
|
||||
@@ -23,7 +33,7 @@ namespace react {
|
||||
* different values in different files, there is no inconsistency in the sizes
|
||||
* of defined symbols.
|
||||
*/
|
||||
#ifdef WITH_FBSYSTRACE
|
||||
#elif defined(WITH_FBSYSTRACE)
|
||||
struct ConcreteSystraceSection {
|
||||
public:
|
||||
template <typename... ConvertsToStringPiece>
|
||||
@@ -41,8 +51,8 @@ struct DummySystraceSection {
|
||||
public:
|
||||
template <typename... ConvertsToStringPiece>
|
||||
explicit DummySystraceSection(
|
||||
const char *name,
|
||||
ConvertsToStringPiece &&...args) {}
|
||||
__unused const char *name,
|
||||
__unused ConvertsToStringPiece &&...args) {}
|
||||
};
|
||||
using SystraceSection = DummySystraceSection;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user