mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
160807d112
Summary: # Issue in iOS Before this diff, [Venice would override](https://www.internalfb.com/code/fbsource/[08e6e7a37f9ac1d33e14fc14ed763c0f8716f73a]/fbobjc/Apps/Internal/Venice/Core/RCTPerformanceLoggerUtils.mm?lines=52%2C57) the static function ReactMarker::LogTaggedMarker [created in CxxBridge](https://www.internalfb.com/code/fbsource/[08e6e7a37f9ac1d33e14fc14ed763c0f8716f73a]/xplat/js/react-native-github/React/CxxBridge/RCTCxxBridge.mm?lines=179%2C183). This means that in mixed mode they would share the Bridgeless instance of RCTPerformanceLogger [owned by Venice-only RCTInstance](https://www.internalfb.com/code/fbsource/[08e6e7a37f9ac1d33e14fc14ed763c0f8716f73a]/fbobjc/Apps/Internal/Venice/Core/RCTInstance.mm?lines=65%2C73). This is wrong because Bridge is supposed to use the instance of RCTPerformanceLogger [owned by RCTBridge](https://www.internalfb.com/code/fbsource/[73ab70b2d9e28569171b62f60e9f25744461d4d9]/xplat/js/react-native-github/React/Base/RCTBridge.m?lines=353). # Fix iOS and refactor Android 1) Add LogTaggedMarkerBridgeless to use the bridgeless RCTPerformanceLogger. 2) Use LogTaggedMarkerBridgeless to replace logTaggedMarkerWithInstanceKey. - Remove logTaggedMarkerWithInstanceKey because it always clear from the code that instanceKey is 0 for Bridge, and 1 for Bridgeless, - iOS doesn't use instanceKey and keeps separate instances of FBReactBridgeStartupLogger, FBReactWildePerfLogger, and RCTPerformanceLogger instead. This is better than using instanceKey because they are all [deallocated when Bridgeless is invalidated](https://www.internalfb.com/code/fbsource/[ea436e5ea6ae4ebc5e206197c4900022be867135]/fbobjc/Apps/Wilde/FBReactModule2/FBReactModuleAPI/FBReactModuleAPI/Exported/FBReactModule.mm?lines=1160%2C1167%2C1170). - logTaggedMarkerWithInstanceKey is only called from Venice's ReactInstance.cpp so it's easy to remove. Reviewed By: sshic Differential Revision: D32588327 fbshipit-source-id: 3151a44c9796da88fef4459b9b56946861514435
37 lines
804 B
C++
37 lines
804 B
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.
|
|
*/
|
|
|
|
#include "ReactMarker.h"
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
namespace ReactMarker {
|
|
|
|
#if __clang__
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wglobal-constructors"
|
|
#endif
|
|
|
|
LogTaggedMarker logTaggedMarker = nullptr;
|
|
LogTaggedMarker logTaggedMarkerBridgeless = nullptr;
|
|
|
|
#if __clang__
|
|
#pragma clang diagnostic pop
|
|
#endif
|
|
|
|
void logMarker(const ReactMarkerId markerId) {
|
|
logTaggedMarker(markerId, nullptr);
|
|
}
|
|
|
|
void logMarkerBridgeless(const ReactMarkerId markerId) {
|
|
logTaggedMarkerBridgeless(markerId, nullptr);
|
|
}
|
|
|
|
} // namespace ReactMarker
|
|
} // namespace react
|
|
} // namespace facebook
|