Use a map to track pending requests sent to Java. Use key as callback_id.
Previously: Use the address of the URLCheckCallbackMeta object as a callback_id. This id was is to track the pending requests in Java. When a response is received, reinterpret the callback ID as an address to the URLCheckCallbackMeta object and then call Run on the callback object. This caused a race condition if the request timed out in Java and the object address got re-used. See: crbug/889972#c44 Now: Maintain a map of pending requests sent to Java in a map <callback_id (int), URLCheckCallbackMeta>. When a response is received, look up the map on IO thread to get the callback object to respond to. The callback_id is based off an incrementing counter, not derived from the address of the callback object. Bug: 893110,889972 Change-Id: I503379ecb1e3f52fc31c272386b1d2f1b065586c Reviewed-on: https://chromium-review.googlesource.com/c/1359308 Commit-Queue: Varun Khaneja <vakh@chromium.org> Reviewed-by:Daniel Rubery <drubery@chromium.org> Reviewed-by:
Nate Fischer <ntfschr@chromium.org> Cr-Commit-Position: refs/heads/master@{#613396}
Showing
Please register or sign in to comment