Skip to content

Commit

Permalink
fix bug in dirty mount logging
Browse files Browse the repository at this point in the history
Summary: There was a bug in mount event logging where mIsDirty was set to false before we logged the previous value. This diff fixes that.

Reviewed By: rohan-mehta

Differential Revision: D15393545

fbshipit-source-id: 01be8fae5610982a021056db5089e4719ee11840
  • Loading branch information
usikder authored and facebook-github-bot committed May 18, 2019
1 parent 05f11a7 commit 3ad8bfb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions litho-core/src/main/java/com/facebook/litho/MountState.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ void mount(LayoutState layoutState, Rect localVisibleRect, boolean processVisibi

mRootTransition = null;
mTransitionsHasBeenCollected = false;
final boolean wasDirty = mIsDirty;
mIsDirty = false;
mNeedsRemount = false;
mIsFirstMountOfComponentTree = false;
Expand All @@ -388,15 +389,16 @@ void mount(LayoutState layoutState, Rect localVisibleRect, boolean processVisibi
suppressInvalidationsOnHosts(false);

if (logger != null) {
logMountPerfEvent(logger, mountPerfEvent);
logMountPerfEvent(logger, mountPerfEvent, wasDirty);
}

if (isTracing) {
ComponentsSystrace.endSection();
}
}

private void logMountPerfEvent(ComponentsLogger logger, @Nullable PerfEvent mountPerfEvent) {
private void logMountPerfEvent(
ComponentsLogger logger, @Nullable PerfEvent mountPerfEvent, boolean isDirty) {
if (!mMountStats.isLoggingEnabled || mountPerfEvent == null) {
logger.cancelPerfEvent(mountPerfEvent);
return;
Expand Down Expand Up @@ -436,7 +438,7 @@ private void logMountPerfEvent(ComponentsLogger logger, @Nullable PerfEvent moun
PARAM_VISIBILITY_HANDLER_TIME, mMountStats.visibilityHandlerTimes.toArray(new Double[0]));

mountPerfEvent.markerAnnotate(PARAM_NO_OP_COUNT, mMountStats.noOpCount);
mountPerfEvent.markerAnnotate(PARAM_IS_DIRTY, mIsDirty);
mountPerfEvent.markerAnnotate(PARAM_IS_DIRTY, isDirty);

logger.logPerfEvent(mountPerfEvent);
}
Expand Down

0 comments on commit 3ad8bfb

Please sign in to comment.