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

Side by Side Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 634313002: Add mouse input forwarding to gpu service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GpuProcessHostUIShim -> GpuProcessHost Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/renderer_host/input/input_router_impl.h" 5 #include "content/browser/renderer_host/input/input_router_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "content/browser/gpu/gpu_process_host.h"
13 #include "content/browser/renderer_host/input/gesture_event_queue.h" 14 #include "content/browser/renderer_host/input/gesture_event_queue.h"
14 #include "content/browser/renderer_host/input/input_ack_handler.h" 15 #include "content/browser/renderer_host/input/input_ack_handler.h"
15 #include "content/browser/renderer_host/input/input_router_client.h" 16 #include "content/browser/renderer_host/input/input_router_client.h"
16 #include "content/browser/renderer_host/input/touch_event_queue.h" 17 #include "content/browser/renderer_host/input/touch_event_queue.h"
17 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" 18 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h"
18 #include "content/common/content_constants_internal.h" 19 #include "content/common/content_constants_internal.h"
19 #include "content/common/edit_command.h" 20 #include "content/common/edit_command.h"
21 #include "content/common/gpu/gpu_messages.h"
20 #include "content/common/input/input_event_ack_state.h" 22 #include "content/common/input/input_event_ack_state.h"
21 #include "content/common/input/touch_action.h" 23 #include "content/common/input/touch_action.h"
22 #include "content/common/input/web_touch_event_traits.h" 24 #include "content/common/input/web_touch_event_traits.h"
23 #include "content/common/input_messages.h" 25 #include "content/common/input_messages.h"
24 #include "content/common/view_messages.h" 26 #include "content/common/view_messages.h"
25 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
26 #include "content/public/browser/notification_types.h" 28 #include "content/public/browser/notification_types.h"
27 #include "content/public/browser/user_metrics.h" 29 #include "content/public/browser/user_metrics.h"
28 #include "content/public/common/content_switches.h" 30 #include "content/public/common/content_switches.h"
29 #include "ipc/ipc_sender.h" 31 #include "ipc/ipc_sender.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 342 }
341 343
342 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event, 344 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event,
343 const ui::LatencyInfo& latency_info, 345 const ui::LatencyInfo& latency_info,
344 bool is_keyboard_shortcut) { 346 bool is_keyboard_shortcut) {
345 output_stream_validator_.Validate(input_event); 347 output_stream_validator_.Validate(input_event);
346 348
347 if (OfferToClient(input_event, latency_info)) 349 if (OfferToClient(input_event, latency_info))
348 return; 350 return;
349 351
352 OfferToGpuService(input_event, is_keyboard_shortcut);
350 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); 353 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut);
351 354
352 // Touch events should always indicate in the event whether they are 355 // Touch events should always indicate in the event whether they are
353 // cancelable (respect ACK disposition) or not. 356 // cancelable (respect ACK disposition) or not.
354 bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event); 357 bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event);
355 if (WebInputEvent::isTouchEventType(input_event.type)) { 358 if (WebInputEvent::isTouchEventType(input_event.type)) {
356 DCHECK(!ignores_ack == 359 DCHECK(!ignores_ack ==
357 static_cast<const blink::WebTouchEvent&>(input_event).cancelable); 360 static_cast<const blink::WebTouchEvent&>(input_event).cancelable);
358 } 361 }
359 362
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // or in-flight event count metrics. 405 // or in-flight event count metrics.
403 if (!WebInputEventTraits::IgnoresAckDisposition(input_event)) { 406 if (!WebInputEventTraits::IgnoresAckDisposition(input_event)) {
404 input_event_start_time_ = TimeTicks::Now(); 407 input_event_start_time_ = TimeTicks::Now();
405 client_->IncrementInFlightEventCount(); 408 client_->IncrementInFlightEventCount();
406 } 409 }
407 return true; 410 return true;
408 } 411 }
409 return false; 412 return false;
410 } 413 }
411 414
415 void InputRouterImpl::OfferToGpuService(const blink::WebInputEvent& input_event,
416 bool is_keyboard_shortcut) {
417 GpuProcessHost::SendOnIO(
418 #if defined(OS_WIN)
419 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED,
jdduke (slow) 2014/10/13 17:14:45 Is the GPU service interested in all event types?
orglofch 2014/10/13 17:30:26 Only mouse events right now. I can't think of a us
420 #else
421 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
422 #endif
423 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
424 new GpuMsg_HandleInputEvent(&input_event, is_keyboard_shortcut));
425 }
426
412 void InputRouterImpl::SendSyntheticWheelEventForPinch( 427 void InputRouterImpl::SendSyntheticWheelEventForPinch(
413 const GestureEventWithLatencyInfo& pinch_event) { 428 const GestureEventWithLatencyInfo& pinch_event) {
414 // We match typical trackpad behavior on Windows by sending fake wheel events 429 // We match typical trackpad behavior on Windows by sending fake wheel events
415 // with the ctrl modifier set when we see trackpad pinch gestures. Ideally 430 // with the ctrl modifier set when we see trackpad pinch gestures. Ideally
416 // we'd someday get a standard 'pinch' event and send that instead. 431 // we'd someday get a standard 'pinch' event and send that instead.
417 432
418 WebMouseWheelEvent wheelEvent; 433 WebMouseWheelEvent wheelEvent;
419 wheelEvent.type = WebInputEvent::MouseWheel; 434 wheelEvent.type = WebInputEvent::MouseWheel;
420 wheelEvent.timeStampSeconds = pinch_event.event.timeStampSeconds; 435 wheelEvent.timeStampSeconds = pinch_event.event.timeStampSeconds;
421 wheelEvent.windowX = wheelEvent.x = pinch_event.event.x; 436 wheelEvent.windowX = wheelEvent.x = pinch_event.event.x;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent( 705 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent(
691 const MouseWheelEventWithLatencyInfo& event, 706 const MouseWheelEventWithLatencyInfo& event,
692 bool synthesized_from_pinch) 707 bool synthesized_from_pinch)
693 : event(event), synthesized_from_pinch(synthesized_from_pinch) { 708 : event(event), synthesized_from_pinch(synthesized_from_pinch) {
694 } 709 }
695 710
696 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() { 711 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() {
697 } 712 }
698 713
699 } // namespace content 714 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/input_router_impl.h ('k') | content/common/gpu/gpu_channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698