Skip to content

Commit

Permalink
Fix: Make ActivityFramesTracker operations thread-safe (#1762)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Oct 14, 2021
1 parent 23884c0 commit 7fd6b52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

* Fix: Make ActivityFramesTracker operations thread-safe (#1762)
* Fix: Clone Scope Contexts (#1763)

## 5.2.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ private boolean isFrameMetricsAggregatorAvailable() {
}

@SuppressWarnings("NullAway")
void addActivity(final @NotNull Activity activity) {
synchronized void addActivity(final @NotNull Activity activity) {
if (!isFrameMetricsAggregatorAvailable()) {
return;
}
frameMetricsAggregator.add(activity);
}

@SuppressWarnings("NullAway")
void setMetrics(final @NotNull Activity activity, final @NotNull SentryId sentryId) {
synchronized void setMetrics(final @NotNull Activity activity, final @NotNull SentryId sentryId) {
if (!isFrameMetricsAggregatorAvailable()) {
return;
}
Expand Down Expand Up @@ -101,7 +101,8 @@ void setMetrics(final @NotNull Activity activity, final @NotNull SentryId sentry
}

@Nullable
Map<String, @NotNull MeasurementValue> takeMetrics(final @NotNull SentryId sentryId) {
synchronized Map<String, @NotNull MeasurementValue> takeMetrics(
final @NotNull SentryId sentryId) {
if (!isFrameMetricsAggregatorAvailable()) {
return null;
}
Expand All @@ -113,7 +114,7 @@ void setMetrics(final @NotNull Activity activity, final @NotNull SentryId sentry
}

@SuppressWarnings("NullAway")
void stop() {
synchronized void stop() {
if (isFrameMetricsAggregatorAvailable()) {
frameMetricsAggregator.stop();
}
Expand Down

0 comments on commit 7fd6b52

Please sign in to comment.