webview: avoid reentrant locking problems.
The metric for re-initializing WebView showed that this is indeed what a small number of apps are doing in a very small proportion of cases. While we don't make any guarantees that this will work and the app might just crash in other ways, there's no benefit to it failing in AwDataDirLock in particular, so it seems preferable to just tolerate it here. So, just allow init to continue if we're already holding the lock, and if we already opened the file but didn't acquire the lock, reuse the already open file to try again, so that we don't end up racing with the finalizer of the old file object and potentially cause more problems. This should prevent us from hitting the OverlappingFileLockException in this code, though apps that are in this state may simply crash somewhere else in initialization later. Fixed: 1054774 Change-Id: I8aade5278a7fad10433a97068e36fbf63196e67a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2498109 Auto-Submit: Richard Coles <torne@chromium.org> Commit-Queue: Nate Fischer <ntfschr@chromium.org> Reviewed-by:Nate Fischer <ntfschr@chromium.org> Cr-Commit-Position: refs/heads/master@{#820970}
Showing
Please register or sign in to comment