Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
cf264cf
Refactor tracing in performance.mark and performance.measure (#49639)
rubennorte Feb 24, 2025
7de8ee7
Introduce the `target_compile_reactnative_options` function (#49747)
cortinico Mar 3, 2025
2da35d4
Move react-native-flags.cmake to ReactCommon (#49745)
cortinico Mar 3, 2025
5052f6c
Refactor PerformanceEntry as std::variant (#50995)
huntie May 2, 2025
7e1b595
Add internal support for PerformanceResourceTiming (#50996)
huntie May 2, 2025
6bfd829
Refactor performanceNow call, remove cxxreact dependency (#51024)
huntie May 2, 2025
b3fe48b
Report PerformanceResourceTiming events (#51025)
huntie May 2, 2025
e82de26
Validate marks presense, if specified (#51389)
hoxyq May 19, 2025
37b7d48
Use HighResTimeStamp (#51511)
hoxyq May 22, 2025
579f821
Replace DOMHighResTimeStamp alias in ReactCommon with new abstraction…
hoxyq May 22, 2025
761301e
Cleanup custom LOG_TAG in our CMakeLists files. (#51622)
cortinico May 28, 2025
b1fc945
Add tests for performance.eventCounts (#52463)
rubennorte Jul 7, 2025
98df71a
Refactor implementation of performance.mark and performance.measure (…
rubennorte Jul 16, 2025
1d48c11
Remove support for specifying track names for Perfetto and RNDT using…
rubennorte Jul 16, 2025
8c22d87
Add support for details field and custom tracks in performance.mark a…
rubennorte Jul 16, 2025
bc52f24
fix: remove redundant if checks in traceMark (#52756)
hannojg Jul 22, 2025
6bf59a4
xplat/js/react-native-github/packages/react-native/ReactCommon/react/…
Jul 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9715,5 +9715,206 @@ declare module.exports: {
get RootTagContext(): RootTagContext,
get unstable_enableLogBox(): () => void,
};
declare export class PerformanceEventTiming extends PerformanceEntry {
constructor(init: {
name: string,
startTime?: DOMHighResTimeStamp,
duration?: DOMHighResTimeStamp,
processingStart?: DOMHighResTimeStamp,
processingEnd?: DOMHighResTimeStamp,
interactionId?: number,
}): void;
get processingStart(): DOMHighResTimeStamp;
get processingEnd(): DOMHighResTimeStamp;
get interactionId(): number;
toJSON(): PerformanceEventTimingJSON;
}
type EventCountsForEachCallbackType =
| (() => void)
| ((value: number) => void)
| ((value: number, key: string) => void)
| ((value: number, key: string, map: Map<string, number>) => void);
declare export class EventCounts {
get size(): number;
entries(): Iterator<[string, number]>;
forEach(callback: EventCountsForEachCallbackType): void;
get(key: string): ?number;
has(key: string): boolean;
keys(): Iterator<string>;
values(): Iterator<number>;
}
"
`;

exports[`public API should not change unintentionally src/private/webapis/performance/LongTasks.js 1`] = `
"export type PerformanceLongTaskTimingJSON = {
...PerformanceEntryJSON,
attribution: $ReadOnlyArray<TaskAttributionTiming>,
...
};
declare export class TaskAttributionTiming extends PerformanceEntry {}
declare export class PerformanceLongTaskTiming extends PerformanceEntry {
get attribution(): $ReadOnlyArray<TaskAttributionTiming>;
toJSON(): PerformanceLongTaskTimingJSON;
}
"
`;

exports[`public API should not change unintentionally src/private/webapis/performance/MemoryInfo.js 1`] = `
"type MemoryInfoLike = {
jsHeapSizeLimit: ?number,
totalJSHeapSize: ?number,
usedJSHeapSize: ?number,
};
declare export default class MemoryInfo {
constructor(memoryInfo: ?MemoryInfoLike): void;
get jsHeapSizeLimit(): ?number;
get totalJSHeapSize(): ?number;
get usedJSHeapSize(): ?number;
}
"
`;

exports[`public API should not change unintentionally src/private/webapis/performance/Performance.js 1`] = `
"export type PerformanceMeasureOptions = {
detail?: DetailType,
start?: DOMHighResTimeStamp,
duration?: DOMHighResTimeStamp,
end?: DOMHighResTimeStamp,
};
declare export default class Performance {
eventCounts: EventCounts;
get memory(): MemoryInfo;
get rnStartupTiming(): ReactNativeStartupTiming;
mark(markName: string, markOptions?: PerformanceMarkOptions): PerformanceMark;
clearMarks(markName?: string): void;
measure(
measureName: string,
startMarkOrOptions?: string | PerformanceMeasureOptions,
endMark?: string
): PerformanceMeasure;
clearMeasures(measureName?: string): void;
now: () => DOMHighResTimeStamp;
getEntries(): PerformanceEntryList;
getEntriesByType(entryType: PerformanceEntryType): PerformanceEntryList;
getEntriesByName(
entryName: string,
entryType?: PerformanceEntryType
): PerformanceEntryList;
}
"
`;

exports[`public API should not change unintentionally src/private/webapis/performance/PerformanceEntry.js 1`] = `
"export type DOMHighResTimeStamp = number;
export type PerformanceEntryType =
| \\"mark\\"
| \\"measure\\"
| \\"event\\"
| \\"longtask\\"
| \\"resource\\";
export type PerformanceEntryJSON = {
name: string,
entryType: PerformanceEntryType,
startTime: DOMHighResTimeStamp,
duration: DOMHighResTimeStamp,
...
};
declare export class PerformanceEntry {
constructor(init: {
name: string,
entryType: PerformanceEntryType,
startTime: DOMHighResTimeStamp,
duration: DOMHighResTimeStamp,
}): void;
get name(): string;
get entryType(): PerformanceEntryType;
get startTime(): DOMHighResTimeStamp;
get duration(): DOMHighResTimeStamp;
toJSON(): PerformanceEntryJSON;
}
export type PerformanceEntryList = $ReadOnlyArray<PerformanceEntry>;
"
`;

exports[`public API should not change unintentionally src/private/webapis/performance/PerformanceObserver.js 1`] = `
"export { PerformanceEntry } from \\"./PerformanceEntry\\";
declare export class PerformanceObserverEntryList {
constructor(entries: PerformanceEntryList): void;
getEntries(): PerformanceEntryList;
getEntriesByType(type: PerformanceEntryType): PerformanceEntryList;
getEntriesByName(
name: string,
type?: PerformanceEntryType
): PerformanceEntryList;
}
export type PerformanceObserverCallbackOptions = {
droppedEntriesCount: number,
};
export type PerformanceObserverCallback = (
list: PerformanceObserverEntryList,
observer: PerformanceObserver,
options?: PerformanceObserverCallbackOptions
) => void;
export interface PerformanceObserverInit {
+entryTypes?: Array<PerformanceEntryType>;
+type?: PerformanceEntryType;
+buffered?: boolean;
+durationThreshold?: DOMHighResTimeStamp;
}
declare export class PerformanceObserver {
constructor(callback: PerformanceObserverCallback): void;
observe(options: PerformanceObserverInit): void;
disconnect(): void;
static supportedEntryTypes: $ReadOnlyArray<PerformanceEntryType>;
}
export { PerformanceEventTiming };
"
`;

exports[`public API should not change unintentionally src/private/webapis/performance/ReactNativeStartupTiming.js 1`] = `
"type ReactNativeStartupTimingLike = {
startTime: ?number,
endTime: ?number,
initializeRuntimeStart: ?number,
initializeRuntimeEnd: ?number,
executeJavaScriptBundleEntryPointStart: ?number,
executeJavaScriptBundleEntryPointEnd: ?number,
};
declare export default class ReactNativeStartupTiming {
constructor(startUpTiming: ?ReactNativeStartupTimingLike): void;
get startTime(): ?number;
get endTime(): ?number;
get initializeRuntimeStart(): ?number;
get initializeRuntimeEnd(): ?number;
get executeJavaScriptBundleEntryPointStart(): ?number;
get executeJavaScriptBundleEntryPointEnd(): ?number;
}
"
`;

exports[`public API should not change unintentionally src/private/webapis/performance/UserTiming.js 1`] = `
"export type DetailType = mixed;
export type PerformanceMarkOptions = {
detail?: DetailType,
startTime?: DOMHighResTimeStamp,
};
export type TimeStampOrName = DOMHighResTimeStamp | string;
export type PerformanceMeasureInit = {
detail?: DetailType,
startTime: DOMHighResTimeStamp,
duration: DOMHighResTimeStamp,
};
declare export class PerformanceMark extends PerformanceEntry {
constructor(markName: string, markOptions?: PerformanceMarkOptions): void;
get detail(): DetailType;
}
declare export class PerformanceMeasure extends PerformanceEntry {
constructor(
measureName: string,
measureOptions: PerformanceMeasureInit
): void;
get detail(): DetailType;
}
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/folly-flags.cmake)
# We configured the REACT_COMMON_DIR variable as it's commonly used to reference
# shared C++ code in other targets.
set(REACT_COMMON_DIR ${REACT_ANDROID_DIR}/../ReactCommon)
include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)

# If you have ccache installed, we're going to honor it.
find_program(CCACHE_FOUND ccache)
Expand Down Expand Up @@ -60,21 +61,7 @@ target_include_directories(${CMAKE_PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_BUILD_DIR}/generated/autolinking/src/main/jni)

target_compile_options(${CMAKE_PROJECT_NAME}
PRIVATE
-Wall
-Werror
# We suppress cpp #error and #warning to don't fail the build
# due to use migrating away from
# #include <react/renderer/graphics/conversions.h>
# This can be removed for React Native 0.73
-Wno-error=cpp
-fexceptions
-frtti
-std=c++20
-DLOG_TAG=\"ReactNative\"
-DFOLLY_NO_CONFIG=1
)
target_compile_reactnative_options(${CMAKE_PROJECT_NAME} PRIVATE)

# Prefab packages from React Native
find_package(ReactAndroid REQUIRED CONFIG)
Expand Down
16 changes: 7 additions & 9 deletions packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set(CMAKE_VERBOSE_MAKEFILE on)

project(ReactAndroid)

include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)

# Convert input paths to CMake format (with forward slashes)
file(TO_CMAKE_PATH "${REACT_ANDROID_DIR}" REACT_ANDROID_DIR)
file(TO_CMAKE_PATH "${REACT_BUILD_DIR}" REACT_BUILD_DIR)
Expand All @@ -22,7 +24,6 @@ endif(CCACHE_FOUND)

# Make sure every shared lib includes a .note.gnu.build-id header
add_link_options(-Wl,--build-id)
add_compile_options(-Wall -Werror)

function(add_react_android_subdir relative_path)
add_subdirectory(${REACT_ANDROID_DIR}/${relative_path} ReactAndroid/${relative_path})
Expand Down Expand Up @@ -237,6 +238,8 @@ target_link_libraries(reactnative
yogacore
)

target_compile_reactnative_options(reactnative PRIVATE)

target_include_directories(reactnative
PUBLIC
$<TARGET_PROPERTY:bridgeless,INTERFACE_INCLUDE_DIRECTORIES>
Expand Down Expand Up @@ -355,14 +358,9 @@ add_executable(reactnative_unittest
# ${REACT_COMMON_DIR}/react/renderer/core/tests/ConcreteShadowNodeTest.cpp
# ${REACT_COMMON_DIR}/react/renderer/core/tests/ComponentDescriptorTest.cpp
)
target_compile_options(reactnative_unittest
PRIVATE
-Wall
-Werror
-fexceptions
-frtti
-std=c++20
-DHERMES_ENABLE_DEBUGGER)

target_compile_reactnative_options(reactnative_unittest PRIVATE)
target_compile_options(reactnative_unittest PRIVATE -DHERMES_ENABLE_DEBUGGER)

target_link_libraries(reactnative_unittest
fabricjni
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set(CMAKE_VERBOSE_MAKEFILE on)

add_compile_options(-fexceptions -fno-omit-frame-pointer)

include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)

add_library(glog_init OBJECT glog_init.cpp)

target_include_directories(glog_init PUBLIC .)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)

# This is the 'glue' library responsible of allowing to do so-merging in React Native
# OSS. This library contains just a .c file that is included in every merged library.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

include(${REACT_ANDROID_DIR}/src/main/jni/first-party/jni-lib-merge/SoMerging-utils.cmake)

add_compile_options(
-fvisibility=hidden
-fexceptions
-frtti
-std=c++20
-O3)
include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)

file(GLOB yoga_SRC CONFIGURE_DEPENDS jni/*.cpp)
add_library(yoga OBJECT ${yoga_SRC})
Expand All @@ -27,3 +21,6 @@ target_link_libraries(yoga
log
android
)

target_compile_reactnative_options(yoga PRIVATE)
target_compile_options(yoga PRIVATE -fvisibility=hidden -O3)
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

add_compile_options(-fexceptions -frtti -std=c++20 -Wall -DLOG_TAG=\"ReactNative\")

include(${REACT_ANDROID_DIR}/src/main/jni/first-party/jni-lib-merge/SoMerging-utils.cmake)
include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)

file(GLOB react_devsupportjni_SRC CONFIGURE_DEPENDS *.cpp)

Expand All @@ -21,3 +20,5 @@ target_include_directories(react_devsupportjni PUBLIC .)
target_link_libraries(react_devsupportjni
fbjni
jsinspector)

target_compile_reactnative_options(react_devsupportjni PRIVATE)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
cmake_minimum_required(VERSION 3.13)

include(${REACT_ANDROID_DIR}/src/main/jni/first-party/jni-lib-merge/SoMerging-utils.cmake)
include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)

file(GLOB fabricjni_SRCS CONFIGURE_DEPENDS *.cpp)

Expand Down Expand Up @@ -62,12 +63,4 @@ target_link_libraries(
yoga
)

target_compile_options(
fabricjni
PRIVATE
-DLOG_TAG=\"Fabric\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(fabricjni PRIVATE)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
cmake_minimum_required(VERSION 3.13)

include(${REACT_ANDROID_DIR}/src/main/jni/first-party/jni-lib-merge/SoMerging-utils.cmake)
include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)

file(GLOB react_featureflagsjni_SRCS CONFIGURE_DEPENDS *.cpp)

Expand All @@ -25,13 +26,4 @@ target_link_libraries(
)

target_merge_so(react_featureflagsjni)

target_compile_options(
react_featureflagsjni
PRIVATE
-DLOG_TAG=\"ReactNative\"
-fexceptions
-frtti
-std=c++20
-Wall
)
target_compile_reactnative_options(react_featureflagsjni PRIVATE)
Loading
Loading