Devtools: Fix a number of issues with protocol message scheduling
- Change how protocol messages are dispatched to/in the renderer. Previously the browser process would send 'interrupting' messages using a different DevToolsSession, io_session_. This mojo channel was bound using a task runner on the IO thread in the renderer process, meaning messages would still be processed even when the main thread was blocked. The IO thread would then post a task to the InspectorTaskRunner, causing it to interrupt V8 execution and run the posted task. To simplify this as much as possible, the browser now always uses the io_session_, but the IO thread will post a (non)interrupting task as appropriate for the message. This removes the need to keep the list of interrupting tasks in sync across the browser/renderer. Messages in-transit now always go via the IO thread and get posted to the InspectorTaskRunner, meaning pending messages can be tracked clearly using tracing, rather than sitting in a mojo channel somewhere waiting to get processed. - Add a new task queue for interrupting tasks only. Previously during an interrupt callback, we would run all tasks in the task queue, which could cause tasks that we not meant to be interrupting to be run during an interrupt. Now we run all tasks only from the new queue. - Remove IgnoreInterruptsScope. This was mistakenly applied to all running tasks during a refactoring. There used to be two ways to run tasks, one was refactored to call the other, but then they both used this interrupt scope. We actually don't need it at all because we now only run 'interrupting' tasks during interrupts rather than flushing the entire queue, which might contain non-interrupting tasks. - Remove the use of IgnoreInterruptScope in LocalWindowProxy::Initialize. The comment there doesn't apply now that we ensure we don't run non-interrupting tasks during interrupts. We don't have any calls that can cause JS to run in the ShouldInterruptForMethod list, so no JS will run there. - Add trace events to show how protocol messages are dispatched in the renderer process. These were really useful for debugging all of these issues. - Remove InspectorTaskRunner::IsRunningTask which was not used. Remove all the associated state handling around running_task_. - Remove InspectorTaskRunner::WaitForAndRunSingleTask which was not used. Remove the condition variable and all the handling for it as it was only used from this unused method. Bug: 1010534, 992560 Change-Id: I58c9193ecd1fc784cda22b054a9c5b7bc2f09969 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1926588Reviewed-by:Jochen Eisinger <jochen@chromium.org> Reviewed-by:
Yang Guo <yangguo@chromium.org> Reviewed-by:
Benedikt Meurer <bmeurer@chromium.org> Reviewed-by:
Yuki Shiino <yukishiino@chromium.org> Commit-Queue: Peter Marshall <petermarshall@chromium.org> Cr-Commit-Position: refs/heads/master@{#719957}
Showing
Please register or sign in to comment