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

Side by Side Diff: content/renderer/input/input_event_filter.cc

Issue 324143002: Decouple IPC::MessageFilter from IPC::Channel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Landing Created 6 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 | Annotate | Revision Log
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/renderer/input/input_event_filter.h" 5 #include "content/renderer/input/input_event_filter.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/message_loop/message_loop_proxy.h" 12 #include "base/message_loop/message_loop_proxy.h"
13 #include "cc/input/input_handler.h" 13 #include "cc/input/input_handler.h"
14 #include "content/common/input/did_overscroll_params.h" 14 #include "content/common/input/did_overscroll_params.h"
15 #include "content/common/input/web_input_event_traits.h" 15 #include "content/common/input/web_input_event_traits.h"
16 #include "content/common/input_messages.h" 16 #include "content/common/input_messages.h"
17 #include "content/common/view_messages.h" 17 #include "content/common/view_messages.h"
18 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
19 #include "ipc/ipc_channel.h"
20 #include "ipc/ipc_listener.h" 19 #include "ipc/ipc_listener.h"
20 #include "ipc/ipc_sender.h"
21 #include "ui/gfx/vector2d_f.h" 21 #include "ui/gfx/vector2d_f.h"
22 22
23 using blink::WebInputEvent; 23 using blink::WebInputEvent;
24 24
25 #include "ipc/ipc_message_null_macros.h" 25 #include "ipc/ipc_message_null_macros.h"
26 #undef IPC_MESSAGE_DECL 26 #undef IPC_MESSAGE_DECL
27 #define IPC_MESSAGE_DECL(kind, type, name, in, out, ilist, olist) \ 27 #define IPC_MESSAGE_DECL(kind, type, name, in, out, ilist, olist) \
28 case name::ID: return #name; 28 case name::ID: return #name;
29 29
30 const char* GetInputMessageTypeName(const IPC::Message& message) { 30 const char* GetInputMessageTypeName(const IPC::Message& message) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 SendMessage(scoped_ptr<IPC::Message>( 83 SendMessage(scoped_ptr<IPC::Message>(
84 new InputHostMsg_DidOverscroll(routing_id, params))); 84 new InputHostMsg_DidOverscroll(routing_id, params)));
85 } 85 }
86 86
87 void InputEventFilter::DidStopFlinging(int routing_id) { 87 void InputEventFilter::DidStopFlinging(int routing_id) {
88 SendMessage( 88 SendMessage(
89 scoped_ptr<IPC::Message>(new ViewHostMsg_DidStopFlinging(routing_id))); 89 scoped_ptr<IPC::Message>(new ViewHostMsg_DidStopFlinging(routing_id)));
90 } 90 }
91 91
92 void InputEventFilter::OnFilterAdded(IPC::Channel* channel) { 92 void InputEventFilter::OnFilterAdded(IPC::Sender* sender) {
93 io_loop_ = base::MessageLoopProxy::current(); 93 io_loop_ = base::MessageLoopProxy::current();
94 sender_ = channel; 94 sender_ = sender;
95 } 95 }
96 96
97 void InputEventFilter::OnFilterRemoved() { 97 void InputEventFilter::OnFilterRemoved() {
98 sender_ = NULL; 98 sender_ = NULL;
99 } 99 }
100 100
101 void InputEventFilter::OnChannelClosing() { 101 void InputEventFilter::OnChannelClosing() {
102 sender_ = NULL; 102 sender_ = NULL;
103 } 103 }
104 104
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void InputEventFilter::SendMessageOnIOThread(scoped_ptr<IPC::Message> message) { 212 void InputEventFilter::SendMessageOnIOThread(scoped_ptr<IPC::Message> message) {
213 DCHECK(io_loop_->BelongsToCurrentThread()); 213 DCHECK(io_loop_->BelongsToCurrentThread());
214 214
215 if (!sender_) 215 if (!sender_)
216 return; // Filter was removed. 216 return; // Filter was removed.
217 217
218 sender_->Send(message.release()); 218 sender_->Send(message.release());
219 } 219 }
220 220
221 } // namespace content 221 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/input/input_event_filter.h ('k') | content/renderer/media/audio_input_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698