IndexedDB: Invoke IDBCursor callbacks on destruct Mojo requires that callbacks be called or bindings they're associated with be torn down before the connection is terminated. Previously, the IDBCursor binding was explicitly closed to ensure the callback state correct when the connection was terminated. However, there are cases when the callback is destructed before the cursor bindings can be closed, like when a task holding a callback is on the preemptive queue. This change wraps all cursor callbacks in a destruct invoke wrapper to handle those cases cleanly. In-depth: - the IndexedDBTransaction task queue has tasks that expect to be called in the future - each task contains its args and some of those can be Mojo callbacks - Mojo callbacks require being called or the binding they're on to be closed before they're destroyed - the CursorImpl bindings can't always be closed when a transaction task queue is cleared before the preemptive queue is cleared - some layout tests would trigger this failure in a flaky way by sometimes having CursorContinue callbacks in the transaction task queue when the IDB session is aborted - wrap all cursor callbacks in a special CallbackAbortOnDestruct class that calls the callback on destruct if it hasn't yet been called to ensure by the time the Mojo connection is torn down no callbacks exist Bug: 965090 Change-Id: Ib3a066536c5c481bbf4fe6ceee462512465755d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1618261 Commit-Queue: Chase Phillips <cmp@chromium.org> Reviewed-by: Daniel Murphy <dmurph@chromium.org> Cr-Commit-Position: refs/heads/master@{#662374}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .