Chromium Code Reviews
Description[translate] Fix shutdown race for translate ranker model loader.
The RankerModelLoader was using a background thread to coordinate
its efforts to load the model first from a file, then from a URL.
In some circumstances, browser shutdown could begin while the model
file is being read from disk. If the loader further proceeds to
download the model file from its URL on the background thread, it
performs a racy attempt to grab a scoped_refptr to the Translate
Download Manager's URL Request Context Getter. This access should
not have been made on that thread.
This CL refactors the coordination of the ranker model loader to be
performed on the main browser thread, with I/O operations performed
on the background and I/O threads.
The TranslateURLFetcher now access the TranslateDownloadManager from
the correct thread. It further validates that is was able obtain a
valid URL request context getter before attempting to use it.
BUG=709905
Review-Url: https://codereview.chromium.org/2839433002
Cr-Commit-Position: refs/heads/master@{#467373}
Committed: https://chromium.googlesource.com/chromium/src/+/691c75601912d7b1dad012265a72bfaaea79bd4c
Patch Set 1 #Patch Set 2 : Initial CL #Patch Set 3 : fix unit_tests #Patch Set 4 : rebase #Patch Set 5 : minor cleanups #Patch Set 6 : experiment: delay model load to first translate activity #
Total comments: 8
Patch Set 7 : groby comments #Patch Set 8 : re-enable load on start (no difference observed compared to load on first use) #
Total comments: 16
Patch Set 9 : comments from fdoray #
Total comments: 10
Patch Set 10 : fdoray part deux #Messages
Total messages: 54 (38 generated)
|