Mitigate redundant calls to ContentToVisibleTimeReporter::TabWasShown().
crbug.com/1121339 indicates that there can be a null-pointer access in ContentToVisibleTimeReporter::RecordHistogramsAndTraceEvents() on Mac since 87.0.4241.0. The accessed variable is likely |tab_switch_start_state_|. Since |tab_switch_start_state_| is set before issuing RecordHistogramsAndTraceEvents() callback and reset at the end of that callback, a null-pointer access suggests that TabWasShown() was invoked twice, without a call to RecordHistogramsAndTraceEvents() or TabWasHidden() in-between. To mitigate the crash, this CL invalidates previously issued callbacks when TabWasShown() is invoked. This mitigation is useful to avoid crashes in branch M87. In a separate CL, we will add a DumpWithoutCrashing() to diagnose cases where TabWasShown() is invoked twice, without a call to RecordHistogramsAndTraceEvents() or TabWasHidden() in-between. Bug: 1121339 Change-Id: I6526cf3a001e9647c5f8ec1081f4747f94a160f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414408 Commit-Queue: François Doray <fdoray@chromium.org> Reviewed-by:Kinuko Yasuda <kinuko@chromium.org> Cr-Commit-Position: refs/heads/master@{#808340}
Showing
Please register or sign in to comment