Skip to content

Commit

Permalink
Fabric: Using TelemetryController in RCTMountingManager on iOS
Browse files Browse the repository at this point in the history
Summary:
Here we use `TelemetryController` to instrument mounting transactions in RCTMoutingManagers and wire that with RCTMountingTransactionObserving protocol. Now, performance trackers (flags) that we use can obtain this information and report to some server-side infrastructure. (Which will be implemented in future diffs.)

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D22490581

fbshipit-source-id: 37695560437ae0e27845c3bda2030fe6fa4c6735
  • Loading branch information
shergin authored and facebook-github-bot committed Jul 16, 2020
1 parent 35f2cd2 commit 9f699ae
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions React/Fabric/Mounting/RCTMountingManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#import <react/core/LayoutableShadowNode.h>
#import <react/core/RawProps.h>
#import <react/debug/SystraceSection.h>
#import <react/mounting/TelemetryController.h>

#import "RCTComponentViewProtocol.h"
#import "RCTComponentViewRegistry.h"
Expand Down Expand Up @@ -197,28 +198,20 @@ - (void)performTransaction:(MountingCoordinator::Shared const &)mountingCoordina
SystraceSection s("-[RCTMountingManager performTransaction:]");
RCTAssertMainQueue();

auto transaction = mountingCoordinator->pullTransaction();
if (!transaction.has_value()) {
return;
}

auto surfaceId = transaction->getSurfaceId();
auto &mutations = transaction->getMutations();

if (mutations.empty()) {
return;
}

auto telemetry = transaction->getTelemetry();
auto number = transaction->getNumber();

[self.delegate mountingManager:self willMountComponentsWithRootTag:surfaceId];
_observerCoordinator.notifyObserversMountingTransactionWillMount({surfaceId, number, telemetry});
telemetry.willMount();
RCTPerformMountInstructions(mutations, self.componentViewRegistry, _observerCoordinator, surfaceId);
telemetry.didMount();
_observerCoordinator.notifyObserversMountingTransactionDidMount({surfaceId, number, telemetry});
[self.delegate mountingManager:self didMountComponentsWithRootTag:surfaceId];
auto surfaceId = mountingCoordinator->getSurfaceId();

mountingCoordinator->getTelemetryController().pullTransaction(
[&](MountingTransactionMetadata metadata) {
[self.delegate mountingManager:self willMountComponentsWithRootTag:surfaceId];
_observerCoordinator.notifyObserversMountingTransactionWillMount(metadata);
},
[&](ShadowViewMutationList const &mutations) {
RCTPerformMountInstructions(mutations, _componentViewRegistry, _observerCoordinator, surfaceId);
},
[&](MountingTransactionMetadata metadata) {
_observerCoordinator.notifyObserversMountingTransactionDidMount(metadata);
[self.delegate mountingManager:self didMountComponentsWithRootTag:surfaceId];
});
}

- (void)synchronouslyUpdateViewOnUIThread:(ReactTag)reactTag
Expand Down

0 comments on commit 9f699ae

Please sign in to comment.