MacPWAs: Fix multiple UpdateShortcuts calls happening at once
Our metrics showed high error rates for shortcut creation on Mac. While using the file handling feature (FileHandlingAPI), I found that multiple CopyDirectory() calls could sometimes happen at once which could trigger errors. When the CopyDirectory() calls overlapped, one thread would be deleting files while another thread creates them, and this would lead to one CopyDirectory() call failing with an error. This change adds a lock that UpdateShortcuts() acquires before proceeding to ensure that its later CreateShortcutsAt() call is protected against other threads. Bug: 1090548 Change-Id: I6cb439975e3dd51608420a3f2e14de351b88d0b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2250590 Auto-Submit: Chase Phillips <cmp@chromium.org> Commit-Queue: ccameron <ccameron@chromium.org> Reviewed-by:ccameron <ccameron@chromium.org> Cr-Commit-Position: refs/heads/master@{#779521}
Showing
Please register or sign in to comment