| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/debug/trace_event.h" | 6 #include "base/debug/trace_event.h" |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "content/common/input_messages.h" | 9 #include "content/common/input_messages.h" |
| 10 #include "content/renderer/gpu/input_event_filter.h" | 10 #include "content/renderer/gpu/input_event_filter.h" |
| 11 | 11 |
| 12 using WebKit::WebInputEvent; | 12 using WebKit::WebInputEvent; |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 InputEventFilter::InputEventFilter( | 16 InputEventFilter::InputEventFilter( |
| 17 IPC::Listener* main_listener, | 17 IPC::Listener* main_listener, |
| 18 const scoped_refptr<base::MessageLoopProxy>& target_loop) | 18 const scoped_refptr<base::MessageLoopProxy>& target_loop) |
| 19 : main_loop_(base::MessageLoopProxy::current()), | 19 : main_loop_(base::MessageLoopProxy::current()), |
| 20 main_listener_(main_listener), | 20 main_listener_(main_listener), |
| 21 sender_(NULL), | 21 sender_(NULL), |
| 22 target_loop_(target_loop) { | 22 target_loop_(target_loop) { |
| 23 DCHECK(target_loop_); | 23 DCHECK(target_loop_.get()); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void InputEventFilter::SetBoundHandler(const Handler& handler) { | 26 void InputEventFilter::SetBoundHandler(const Handler& handler) { |
| 27 DCHECK(main_loop_->BelongsToCurrentThread()); | 27 DCHECK(main_loop_->BelongsToCurrentThread()); |
| 28 handler_ = handler; | 28 handler_ = handler; |
| 29 } | 29 } |
| 30 | 30 |
| 31 void InputEventFilter::DidAddInputHandler(int routing_id) { | 31 void InputEventFilter::DidAddInputHandler(int routing_id) { |
| 32 base::AutoLock locked(routes_lock_); | 32 base::AutoLock locked(routes_lock_); |
| 33 routes_.insert(routing_id); | 33 routes_.insert(routing_id); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 if (!sender_) | 150 if (!sender_) |
| 151 return; // Filter was removed. | 151 return; // Filter was removed. |
| 152 | 152 |
| 153 sender_->Send( | 153 sender_->Send( |
| 154 new InputHostMsg_HandleInputEvent_ACK( | 154 new InputHostMsg_HandleInputEvent_ACK( |
| 155 routing_id, event_type, ack_result)); | 155 routing_id, event_type, ack_result)); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace content | 158 } // namespace content |
| OLD | NEW |