Fix data race in browsing_data_remover_test_util
If browser_tests is built with tsan enabled, Thread Sanitizer reports data races in browsing_data_remover_test_util. There are two threads to concurrently access the shared data, the test’s main thread and a thread controlled by TaskScheduler singleton. Both access browsing_data_remover_done_ and/or flush_for_testing_complete_ fields to break run loop and exit test after some cleanup occurs. In TaskScheduler’s thread, the write access is done by the lambda function. The proposed solution is to use the lambda call only to report the asynchronous event to main thread, which becomes the only one to access the fields implementing run loop break logic. R=sky@chromium.org Bug: 885188 Change-Id: I706edb24ed362444cf46e558b1d54389179884da Reviewed-on: https://chromium-review.googlesource.com/1233613Reviewed-by:Robert Liao <robliao@chromium.org> Reviewed-by:
Scott Violet <sky@chromium.org> Commit-Queue: Robert Liao <robliao@chromium.org> Cr-Commit-Position: refs/heads/master@{#593987}
Showing
Please register or sign in to comment