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

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

Issue 15920002: Fix WebView compositor input handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup 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 #ifndef CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ 5 #ifndef CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_
6 #define CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ 6 #define CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "content/renderer/render_view_impl.h" 12 #include "content/renderer/render_view_impl.h"
12 #include "ipc/ipc_channel_proxy.h"
13 13
14 namespace base { 14 namespace base {
15 class MessageLoopProxy; 15 class MessageLoopProxy;
16 } 16 }
17 17
18 namespace cc { 18 namespace cc {
19 class InputHandler; 19 class InputHandler;
20 } 20 }
21 21
22 namespace WebKit { 22 namespace WebKit {
23 class WebInputEvent; 23 class WebInputEvent;
24 } 24 }
25 25
26 namespace content { 26 namespace content {
27 27
28 class InputEventFilter; 28 class InputEventFilter;
29 class InputHandlerWrapper; 29 class InputHandlerWrapper;
30 class InputHandlerManagerClient;
30 31
31 // InputHandlerManager class manages InputHandlerProxy instances for 32 // InputHandlerManager class manages InputHandlerProxy instances for
32 // the WebViews in this renderer. 33 // the WebViews in this renderer.
33 class InputHandlerManager { 34 class InputHandlerManager {
34 public: 35 public:
35 // |main_listener| refers to the central IPC message listener that lives on
36 // the main thread, where all incoming IPC messages are first handled.
37 // |message_loop_proxy| is the MessageLoopProxy of the compositor thread. 36 // |message_loop_proxy| is the MessageLoopProxy of the compositor thread.
38 // The underlying MessageLoop must outlive this object. 37 // The underlying MessageLoop must outlive this object.
39 InputHandlerManager( 38 InputHandlerManager(
40 IPC::Listener* main_listener,
41 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy); 39 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy);
42 ~InputHandlerManager(); 40 ~InputHandlerManager();
43 41
44 // This MessageFilter should be added to allow input events to be redirected 42 // Called from the main thread only. Only one client can be bound to an
45 // to the compositor's thread. 43 // InputHandlerManager, and the client must outlive this object.
46 IPC::ChannelProxy::MessageFilter* GetMessageFilter() const; 44 void BindToClient(InputHandlerManagerClient* client);
45
46 // Called from the compositor's thread.
47 InputHandlerManagerClient* client() { return client_; }
47 48
48 // Callable from the main thread only. 49 // Callable from the main thread only.
49 void AddInputHandler( 50 void AddInputHandler(
50 int routing_id, 51 int routing_id,
51 const base::WeakPtr<cc::InputHandler>& input_handler, 52 const base::WeakPtr<cc::InputHandler>& input_handler,
52 const base::WeakPtr<RenderViewImpl>& render_view_impl); 53 const base::WeakPtr<RenderViewImpl>& render_view_impl);
53 54
54 // Callback only from the compositor's thread. 55 // Callback only from the compositor's thread.
55 void RemoveInputHandler(int routing_id); 56 void RemoveInputHandler(int routing_id);
56 57
57 // Called from the compositor's thread. 58 // Called from the compositor's thread.
58 void HandleInputEvent(int routing_id, 59 void HandleInputEvent(int routing_id,
59 const WebKit::WebInputEvent* input_event); 60 const WebKit::WebInputEvent* input_event);
60 61
61 // Called from the compositor's thread.
62 InputEventFilter* filter() { return filter_.get(); }
63
64 private: 62 private:
65 // Called from the compositor's thread. 63 // Called from the compositor's thread.
66 void AddInputHandlerOnCompositorThread( 64 void AddInputHandlerOnCompositorThread(
67 int routing_id, 65 int routing_id,
68 const scoped_refptr<base::MessageLoopProxy>& main_loop, 66 const scoped_refptr<base::MessageLoopProxy>& main_loop,
69 const base::WeakPtr<cc::InputHandler>& input_handler, 67 const base::WeakPtr<cc::InputHandler>& input_handler,
70 const base::WeakPtr<RenderViewImpl>& render_view_impl); 68 const base::WeakPtr<RenderViewImpl>& render_view_impl);
71 69
72 typedef std::map<int, // routing_id 70 typedef std::map<int, // routing_id
73 scoped_refptr<InputHandlerWrapper> > InputHandlerMap; 71 scoped_refptr<InputHandlerWrapper> > InputHandlerMap;
74 InputHandlerMap input_handlers_; 72 InputHandlerMap input_handlers_;
75 73
76 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 74 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
77 scoped_refptr<InputEventFilter> filter_; 75 InputHandlerManagerClient* client_;
78 }; 76 };
79 77
80 } // namespace content 78 } // namespace content
81 79
82 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ 80 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698