Commit fad5e6ac authored by alexst's avatar alexst Committed by Commit bot

[ozone] Temporary workaround for GPU support message filter not being installed early enough.

Some initial messages may get routed to main thread. Once we get
our first message on io, send it to main to ensure all prior main
thread operations are finished before we continue on io.

BUG=446184

Review URL: https://codereview.chromium.org/801233003

Cr-Commit-Position: refs/heads/master@{#311497}
parent 672e7140
...@@ -34,7 +34,8 @@ class DriGpuPlatformSupportMessageFilter : public IPC::MessageFilter { ...@@ -34,7 +34,8 @@ class DriGpuPlatformSupportMessageFilter : public IPC::MessageFilter {
main_thread_listener_(main_thread_listener), main_thread_listener_(main_thread_listener),
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
pending_main_thread_operations_(0), pending_main_thread_operations_(0),
cursor_animating_(false) {} cursor_animating_(false),
start_on_main_(true) {}
void OnFilterAdded(IPC::Sender* sender) override { void OnFilterAdded(IPC::Sender* sender) override {
io_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get(); io_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get();
...@@ -59,7 +60,8 @@ class DriGpuPlatformSupportMessageFilter : public IPC::MessageFilter { ...@@ -59,7 +60,8 @@ class DriGpuPlatformSupportMessageFilter : public IPC::MessageFilter {
bool cursor_was_animating = cursor_animating_; bool cursor_was_animating = cursor_animating_;
UpdateAnimationState(message); UpdateAnimationState(message);
if (cursor_state_message || pending_main_thread_operations_ || if (cursor_state_message || pending_main_thread_operations_ ||
cursor_animating_ || cursor_was_animating) { cursor_animating_ || cursor_was_animating || start_on_main_) {
start_on_main_ = false;
pending_main_thread_operations_++; pending_main_thread_operations_++;
base::Closure main_thread_message_handler = base::Closure main_thread_message_handler =
...@@ -151,6 +153,12 @@ class DriGpuPlatformSupportMessageFilter : public IPC::MessageFilter { ...@@ -151,6 +153,12 @@ class DriGpuPlatformSupportMessageFilter : public IPC::MessageFilter {
scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
int32 pending_main_thread_operations_; int32 pending_main_thread_operations_;
bool cursor_animating_; bool cursor_animating_;
// The filter is not installed early enough, so some messages may
// get routed to main thread. Once we get our first message on io, send it
// to main to ensure all prior main thread operations are finished before we
// continue on io.
// TODO: remove this once filter is properly installed.
bool start_on_main_;
}; };
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment