[iOS] Add mutation lock to WebStateList.
This CL adds a mutation lock to WebStateList, to prevent observer callbacks from changing or deleting the WSL while a change to the WSL is in-flight. Another approach would have been to make the WebStateList passed back to observers a const WSL, but in many cases WSL observers already have another pointer to the WSL which they use for mutations. The lock implementation is straightforward, using a scoped lock object to set/unset lock state on the WebStateList. This isn't threadsafe, but WSL isn't, either. WSL will CHECK in the case of a double-lock, or of destruction while locked. Bug: 834263 Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet Change-Id: I3bf3512cec3297e7580cfc67c71bb12c05bc1cf5 Reviewed-on: https://chromium-review.googlesource.com/1065632 Commit-Queue: Mark Cogan <marq@chromium.org> Reviewed-by:Sylvain Defresne <sdefresne@chromium.org> Cr-Commit-Position: refs/heads/master@{#561045}
Showing
Please register or sign in to comment