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

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

Issue 2576013002: Introducing WebCoalescedInputEvent and inclusion in content/common (Closed)
Patch Set: Fix a few DCHECK hits Created 3 years, 11 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/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void CompositorMusConnection::OnConnectionLostOnMainThread() { 89 void CompositorMusConnection::OnConnectionLostOnMainThread() {
90 DCHECK(main_task_runner_->BelongsToCurrentThread()); 90 DCHECK(main_task_runner_->BelongsToCurrentThread());
91 RenderWidgetMusConnection* connection = 91 RenderWidgetMusConnection* connection =
92 RenderWidgetMusConnection::Get(routing_id_); 92 RenderWidgetMusConnection::Get(routing_id_);
93 if (!connection) 93 if (!connection)
94 return; 94 return;
95 connection->OnConnectionLost(); 95 connection->OnConnectionLost();
96 } 96 }
97 97
98 void CompositorMusConnection::OnWindowInputEventOnMainThread( 98 void CompositorMusConnection::OnWindowInputEventOnMainThread(
99 ui::ScopedWebInputEvent web_event, 99 blink::WebScopedInputEvent web_event,
100 const base::Callback<void(EventResult)>& ack) { 100 const base::Callback<void(EventResult)>& ack) {
101 DCHECK(main_task_runner_->BelongsToCurrentThread()); 101 DCHECK(main_task_runner_->BelongsToCurrentThread());
102 RenderWidgetMusConnection* connection = 102 RenderWidgetMusConnection* connection =
103 RenderWidgetMusConnection::Get(routing_id_); 103 RenderWidgetMusConnection::Get(routing_id_);
104 if (!connection) { 104 if (!connection) {
105 ack.Run(EventResult::UNHANDLED); 105 ack.Run(EventResult::UNHANDLED);
106 return; 106 return;
107 } 107 }
108 connection->OnWindowInputEvent(std::move(web_event), ack); 108 connection->OnWindowInputEvent(std::move(web_event), ack);
109 } 109 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 void CompositorMusConnection::OnWindowInputEvent( 181 void CompositorMusConnection::OnWindowInputEvent(
182 ui::Window* window, 182 ui::Window* window,
183 const ui::Event& event, 183 const ui::Event& event,
184 std::unique_ptr<base::Callback<void(EventResult)>>* ack_callback) { 184 std::unique_ptr<base::Callback<void(EventResult)>>* ack_callback) {
185 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); 185 DCHECK(compositor_task_runner_->BelongsToCurrentThread());
186 186
187 // Take ownership of the callback, indicating that we will handle it. 187 // Take ownership of the callback, indicating that we will handle it.
188 std::unique_ptr<base::Callback<void(EventResult)>> callback = 188 std::unique_ptr<base::Callback<void(EventResult)>> callback =
189 std::move(*ack_callback); 189 std::move(*ack_callback);
190 ui::ScopedWebInputEvent web_event(Convert(event).release()); 190 blink::WebScopedInputEvent web_event(Convert(event).release());
191 // TODO(sad): We probably need to plumb LatencyInfo through Mus. 191 // TODO(sad): We probably need to plumb LatencyInfo through Mus.
192 ui::LatencyInfo info; 192 ui::LatencyInfo info;
193 input_handler_manager_->HandleInputEvent( 193 input_handler_manager_->HandleInputEvent(
194 routing_id_, std::move(web_event), info, 194 routing_id_, std::move(web_event), info,
195 base::Bind( 195 base::Bind(
196 &CompositorMusConnection::DidHandleWindowInputEventAndOverscroll, 196 &CompositorMusConnection::DidHandleWindowInputEventAndOverscroll,
197 this, base::Passed(std::move(callback)))); 197 this, base::Passed(std::move(callback))));
198 } 198 }
199 199
200 void CompositorMusConnection::DidHandleWindowInputEventAndOverscroll( 200 void CompositorMusConnection::DidHandleWindowInputEventAndOverscroll(
201 std::unique_ptr<base::Callback<void(EventResult)>> ack_callback, 201 std::unique_ptr<base::Callback<void(EventResult)>> ack_callback,
202 InputEventAckState ack_state, 202 InputEventAckState ack_state,
203 ui::ScopedWebInputEvent web_event, 203 blink::WebScopedInputEvent web_event,
204 const ui::LatencyInfo& latency_info, 204 const ui::LatencyInfo& latency_info,
205 std::unique_ptr<ui::DidOverscrollParams> overscroll_params) { 205 std::unique_ptr<ui::DidOverscrollParams> overscroll_params) {
206 // TODO(jonross): We probably need to ack the event based on the consumed 206 // TODO(jonross): We probably need to ack the event based on the consumed
207 // state. 207 // state.
208 if (ack_state != INPUT_EVENT_ACK_STATE_NOT_CONSUMED) { 208 if (ack_state != INPUT_EVENT_ACK_STATE_NOT_CONSUMED) {
209 // We took the ownership of the callback, so we need to send the ack, and 209 // We took the ownership of the callback, so we need to send the ack, and
210 // mark the event as not consumed to preserve existing behavior. 210 // mark the event as not consumed to preserve existing behavior.
211 ack_callback->Run(EventResult::UNHANDLED); 211 ack_callback->Run(EventResult::UNHANDLED);
212 return; 212 return;
213 } 213 }
(...skipping 16 matching lines...) Expand all
230 } 230 }
231 ack_callback.reset(); 231 ack_callback.reset();
232 232
233 main_task_runner_->PostTask( 233 main_task_runner_->PostTask(
234 FROM_HERE, 234 FROM_HERE,
235 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, 235 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this,
236 base::Passed(std::move(web_event)), ack)); 236 base::Passed(std::move(web_event)), ack));
237 } 237 }
238 238
239 } // namespace content 239 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698