Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: content/renderer/mus/compositor_mus_connection.cc

Issue 1780953003: Change the non-blocking event queue to the main thread event queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_regression_5
Patch Set: Fix android Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/mus/compositor_mus_connection.h" 5 #include "content/renderer/mus/compositor_mus_connection.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "content/common/input/web_input_event_traits.h" 8 #include "content/common/input/web_input_event_traits.h"
9 #include "content/renderer/input/input_handler_manager.h" 9 #include "content/renderer/input/input_handler_manager.h"
10 #include "content/renderer/mus/render_widget_mus_connection.h" 10 #include "content/renderer/mus/render_widget_mus_connection.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 mus::mojom::Event::From(event).To<scoped_ptr<blink::WebInputEvent>>()); 124 mus::mojom::Event::From(event).To<scoped_ptr<blink::WebInputEvent>>());
125 // TODO(sad): We probably need to plumb LatencyInfo through Mus. 125 // TODO(sad): We probably need to plumb LatencyInfo through Mus.
126 ui::LatencyInfo info; 126 ui::LatencyInfo info;
127 InputEventAckState ack_state = input_handler_manager_->HandleInputEvent( 127 InputEventAckState ack_state = input_handler_manager_->HandleInputEvent(
128 routing_id_, web_event.get(), &info); 128 routing_id_, web_event.get(), &info);
129 // TODO(jonross): We probably need to ack the event based on the consumed 129 // TODO(jonross): We probably need to ack the event based on the consumed
130 // state. 130 // state.
131 if (ack_state != INPUT_EVENT_ACK_STATE_NOT_CONSUMED) 131 if (ack_state != INPUT_EVENT_ACK_STATE_NOT_CONSUMED)
132 return; 132 return;
133 base::Callback<void(bool)> ack = base::Bind(&::DoNothingBool); 133 base::Callback<void(bool)> ack = base::Bind(&::DoNothingBool);
134 const bool send_ack = 134 const bool send_ack = WebInputEventTraits::ShouldBlockEventStream(*web_event);
135 WebInputEventTraits::WillReceiveAckFromRenderer(*web_event);
136 if (send_ack) { 135 if (send_ack) {
137 // Ultimately, this ACK needs to go back to the Mus client lib which is not 136 // Ultimately, this ACK needs to go back to the Mus client lib which is not
138 // thread-safe and lives on the compositor thread. For ACKs that are passed 137 // thread-safe and lives on the compositor thread. For ACKs that are passed
139 // to the main thread we pass them back to the compositor thread via 138 // to the main thread we pass them back to the compositor thread via
140 // OnWindowInputEventAckOnMainThread. 139 // OnWindowInputEventAckOnMainThread.
141 ack = 140 ack =
142 base::Bind(&CompositorMusConnection::OnWindowInputEventAckOnMainThread, 141 base::Bind(&CompositorMusConnection::OnWindowInputEventAckOnMainThread,
143 this, *ack_callback->get()); 142 this, *ack_callback->get());
144 ack_callback->reset(); 143 ack_callback->reset();
145 } 144 }
146 main_task_runner_->PostTask( 145 main_task_runner_->PostTask(
147 FROM_HERE, 146 FROM_HERE,
148 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, 147 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this,
149 base::Passed(std::move(web_event)), ack)); 148 base::Passed(std::move(web_event)), ack));
150 } 149 }
151 150
152 } // namespace content 151 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698