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

Side by Side Diff: content/renderer/gpu/input_handler_manager.cc

Issue 15927023: Explicit interface for synchronous InputHandlerProxy input handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shorter names ftw Created 7 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gpu/input_handler_manager.h" 5 #include "content/renderer/gpu/input_handler_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/input/input_handler.h" 9 #include "cc/input/input_handler.h"
10 #include "content/renderer/gpu/input_event_filter.h" 10 #include "content/renderer/gpu/input_event_filter.h"
11 #include "content/renderer/gpu/input_handler_wrapper.h" 11 #include "content/renderer/gpu/input_handler_wrapper.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebActiveWheelFlingPa rameters.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebActiveWheelFlingPa rameters.h"
13 13
14 using WebKit::WebInputEvent; 14 using WebKit::WebInputEvent;
15 15
16 namespace content { 16 namespace content {
17 17
18 namespace {
19
20 InputEventAckState InputEventDispositionToAck(
21 InputHandlerProxy::EventDisposition disposition) {
22 switch (disposition) {
23 case InputHandlerProxy::DID_HANDLE:
24 return INPUT_EVENT_ACK_STATE_CONSUMED;
25 case InputHandlerProxy::DID_NOT_HANDLE:
26 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
27 case InputHandlerProxy::DROP_EVENT:
28 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
29 }
30 NOTREACHED();
31 return INPUT_EVENT_ACK_STATE_UNKNOWN;
32 }
33
34 } // namespace
35
18 InputHandlerManager::InputHandlerManager( 36 InputHandlerManager::InputHandlerManager(
19 IPC::Listener* main_listener, 37 IPC::Listener* main_listener,
20 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy) 38 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy)
21 : message_loop_proxy_(message_loop_proxy) { 39 : message_loop_proxy_(message_loop_proxy) {
22 filter_ = 40 filter_ =
23 new InputEventFilter(main_listener, 41 new InputEventFilter(main_listener,
24 message_loop_proxy, 42 message_loop_proxy,
25 base::Bind(&InputHandlerManager::HandleInputEvent, 43 base::Bind(&InputHandlerManager::HandleInputEvent,
26 base::Unretained(this))); 44 base::Unretained(this)));
27 } 45 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 92
75 void InputHandlerManager::RemoveInputHandler(int routing_id) { 93 void InputHandlerManager::RemoveInputHandler(int routing_id) {
76 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); 94 DCHECK(message_loop_proxy_->BelongsToCurrentThread());
77 95
78 TRACE_EVENT0("InputHandlerManager::RemoveInputHandler", "RemovingRoute"); 96 TRACE_EVENT0("InputHandlerManager::RemoveInputHandler", "RemovingRoute");
79 97
80 filter_->RemoveRoute(routing_id); 98 filter_->RemoveRoute(routing_id);
81 input_handlers_.erase(routing_id); 99 input_handlers_.erase(routing_id);
82 } 100 }
83 101
84 void InputHandlerManager::HandleInputEvent( 102 InputEventAckState InputHandlerManager::HandleInputEvent(
85 int routing_id, 103 int routing_id,
86 const WebInputEvent* input_event) { 104 const WebInputEvent* input_event) {
87 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); 105 DCHECK(message_loop_proxy_->BelongsToCurrentThread());
88 106
89 InputHandlerMap::iterator it = input_handlers_.find(routing_id); 107 InputHandlerMap::iterator it = input_handlers_.find(routing_id);
90 if (it == input_handlers_.end()) { 108 if (it == input_handlers_.end()) {
91 TRACE_EVENT0("InputHandlerManager::HandleInputEvent", 109 TRACE_EVENT0("InputHandlerManager::HandleInputEvent",
92 "NoInputHandlerFound"); 110 "NoInputHandlerFound");
93 // Oops, we no longer have an interested input handler.. 111 // Oops, we no longer have an interested input handler..
94 filter_->DidNotHandleInputEvent(true); 112 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
95 return;
96 } 113 }
97 114
98 it->second->input_handler_proxy()->HandleInputEvent(*input_event); 115 return InputEventDispositionToAck(
116 it->second->input_handler_proxy()->HandleInputEvent(*input_event));
99 } 117 }
100 118
101 } // namespace content 119 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/input_handler_manager.h ('k') | content/renderer/gpu/input_handler_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698