From 890805db9cc639846c93edc0e13eddbf67dbc7af Mon Sep 17 00:00:00 2001 From: Sergei Karpukhin Date: Thu, 3 Nov 2022 02:44:08 -0700 Subject: [PATCH] Add various annotation types to markEvent ReactNative API Summary: Support various annotations types in QuickPerformanceLogger markEvent for Android. Changelog: [Internal][Changed] - Added support for various markEvent annotation types Reviewed By: dmitry-voronkevich Differential Revision: D40852658 fbshipit-source-id: fc4053555f65958653be30a58742c83040a19df1 --- .../Performance/QuickPerformanceLogger.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Libraries/Performance/QuickPerformanceLogger.js b/Libraries/Performance/QuickPerformanceLogger.js index 9e8a6cd657c3a4..4a0da73e47825d 100644 --- a/Libraries/Performance/QuickPerformanceLogger.js +++ b/Libraries/Performance/QuickPerformanceLogger.js @@ -18,6 +18,13 @@ const DUMMY_INSTANCE_KEY = 0; // {string: {key1: value1, key2: value2}} export type AnnotationsMap = $Shape<{ string: ?{[string]: string, ...}, + int: ?{[string]: number, ...}, + double: ?{[string]: number, ...}, + bool: ?{[string]: boolean, ...}, + string_array: ?{[string]: $ReadOnlyArray, ...}, + int_array: ?{[string]: $ReadOnlyArray, ...}, + double_array: ?{[string]: $ReadOnlyArray, ...}, + bool_array: ?{[string]: $ReadOnlyArray, ...}, }>; const QuickPerformanceLogger = { @@ -60,7 +67,16 @@ const QuickPerformanceLogger = { if (global.nativeQPLMarkerAnnotateWithMap) { global.nativeQPLMarkerAnnotateWithMap(markerId, annotations, instanceKey); } else if (global.nativeQPLMarkerAnnotate) { - for (const type of ['string']) { + for (const type of [ + 'string', + 'int', + 'double', + 'bool', + 'string_array', + 'int_array', + 'double_array', + 'bool_array', + ]) { const keyValsOfType = annotations[type]; if (keyValsOfType != null) { for (const annotationKey of Object.keys(keyValsOfType)) {