From fc1f5bbb922be1cd2d367eccf2f837cbe71cb466 Mon Sep 17 00:00:00 2001 From: Oleksandr Melnykov Date: Mon, 25 Apr 2022 04:14:39 -0700 Subject: [PATCH] Ensure correct instance for transaction telemetry Summary: Ensures that transaction telemetry modified by transaction controller is the same as sent in the view callbacks. Changelog: [Internal] Reviewed By: cortinico, cipolleschi Differential Revision: D35827347 fbshipit-source-id: 123ae01d4a7fe1a9c97ebccae3ae248f7f2cf654 --- ReactCommon/react/renderer/mounting/MountingTransaction.cpp | 2 +- ReactCommon/react/renderer/mounting/MountingTransaction.h | 4 ++-- ReactCommon/react/renderer/mounting/TelemetryController.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ReactCommon/react/renderer/mounting/MountingTransaction.cpp b/ReactCommon/react/renderer/mounting/MountingTransaction.cpp index 19a814f8a06..8c3e2c37472 100644 --- a/ReactCommon/react/renderer/mounting/MountingTransaction.cpp +++ b/ReactCommon/react/renderer/mounting/MountingTransaction.cpp @@ -30,7 +30,7 @@ ShadowViewMutationList MountingTransaction::getMutations() && { return std::move(mutations_); } -TransactionTelemetry const &MountingTransaction::getTelemetry() const { +TransactionTelemetry &MountingTransaction::getTelemetry() const { return telemetry_; } diff --git a/ReactCommon/react/renderer/mounting/MountingTransaction.h b/ReactCommon/react/renderer/mounting/MountingTransaction.h index 055056fea1a..6a65d8dab9f 100644 --- a/ReactCommon/react/renderer/mounting/MountingTransaction.h +++ b/ReactCommon/react/renderer/mounting/MountingTransaction.h @@ -65,7 +65,7 @@ class MountingTransaction final { /* * Returns telemetry associated with this transaction. */ - TransactionTelemetry const &getTelemetry() const; + TransactionTelemetry &getTelemetry() const; /* * Returns the id of the surface that the transaction belongs to. @@ -81,7 +81,7 @@ class MountingTransaction final { SurfaceId surfaceId_; Number number_; ShadowViewMutationList mutations_; - TransactionTelemetry telemetry_; + mutable TransactionTelemetry telemetry_; }; } // namespace react diff --git a/ReactCommon/react/renderer/mounting/TelemetryController.cpp b/ReactCommon/react/renderer/mounting/TelemetryController.cpp index 98d4eecba9c..25ef9bee650 100644 --- a/ReactCommon/react/renderer/mounting/TelemetryController.cpp +++ b/ReactCommon/react/renderer/mounting/TelemetryController.cpp @@ -27,7 +27,7 @@ bool TelemetryController::pullTransaction( auto transaction = std::move(*optional); - auto telemetry = transaction.getTelemetry(); + auto &telemetry = transaction.getTelemetry(); auto numberOfMutations = static_cast(transaction.getMutations().size()); mutex_.lock();