ScriptStreamer has a comment claiming that it won't notify its client twice of completion.
Unfortunately, this can happen with the following sequence of events:
- parsing completes on background thread (e.g. due to parse error)
- task is posted to main thread
- loading completes on main thread
- loading and parse are both complete, so work is finished -> client notified
- posted task runs
- loading and parse are both complete, so work is finished -> client notified
I think a reasonable fix is not to set the parsing complete thing until the task arrives. After I do that, all of the variables guarded by ScriptStreamer::m_mutex are accessed on the main thread only, so the mutex can also be removed.
Comment 1 by bugdroid1@chromium.org
, Mar 3 2017