OLD | NEW |
---|---|
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 #ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
7 | 7 |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 namespace blink { | 22 namespace blink { |
23 class WebInputEvent; | 23 class WebInputEvent; |
24 } | 24 } |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 class InputHandlerWrapper; | 28 class InputHandlerWrapper; |
29 class InputHandlerManagerClient; | 29 class InputHandlerManagerClient; |
30 struct DidOverscrollParams; | 30 struct DidOverscrollParams; |
31 class RendererScheduler; | |
31 | 32 |
32 // InputHandlerManager class manages InputHandlerProxy instances for | 33 // InputHandlerManager class manages InputHandlerProxy instances for |
33 // the WebViews in this renderer. | 34 // the WebViews in this renderer. |
34 class InputHandlerManager { | 35 class InputHandlerManager { |
35 public: | 36 public: |
36 // |message_loop_proxy| is the MessageLoopProxy of the compositor thread. Both | 37 // |message_loop_proxy| is the MessageLoopProxy of the compositor thread. The |
37 // the underlying MessageLoop and supplied |client| must outlive this object. | 38 // underlying MessageLoop and supplied |client| and the |renderer_scheduler| |
39 // must outlive this object. The RendererScheduler needs to know when input | |
40 // events and compositor animations occur, which is why it's passed in here. | |
Sami
2014/11/06 22:17:34
nit: s/compositor/fling/ would be a little more ac
alex clarke (OOO till 29th)
2014/11/06 22:32:15
Done.
| |
38 InputHandlerManager( | 41 InputHandlerManager( |
39 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, | 42 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, |
40 InputHandlerManagerClient* client); | 43 InputHandlerManagerClient* client, |
44 RendererScheduler* renderer_scheduler); | |
41 ~InputHandlerManager(); | 45 ~InputHandlerManager(); |
42 | 46 |
43 // Callable from the main thread only. | 47 // Callable from the main thread only. |
44 void AddInputHandler( | 48 void AddInputHandler( |
45 int routing_id, | 49 int routing_id, |
46 const base::WeakPtr<cc::InputHandler>& input_handler, | 50 const base::WeakPtr<cc::InputHandler>& input_handler, |
47 const base::WeakPtr<RenderViewImpl>& render_view_impl); | 51 const base::WeakPtr<RenderViewImpl>& render_view_impl); |
48 | 52 |
49 // Callback only from the compositor's thread. | 53 // Callback only from the compositor's thread. |
50 void RemoveInputHandler(int routing_id); | 54 void RemoveInputHandler(int routing_id); |
51 | 55 |
52 // Called from the compositor's thread. | 56 // Called from the compositor's thread. |
53 InputEventAckState HandleInputEvent(int routing_id, | 57 InputEventAckState HandleInputEvent(int routing_id, |
54 const blink::WebInputEvent* input_event, | 58 const blink::WebInputEvent* input_event, |
55 ui::LatencyInfo* latency_info); | 59 ui::LatencyInfo* latency_info); |
56 | 60 |
57 // Called from the compositor's thread. | 61 // Called from the compositor's thread. |
58 void DidOverscroll(int routing_id, const DidOverscrollParams& params); | 62 void DidOverscroll(int routing_id, const DidOverscrollParams& params); |
59 | 63 |
60 // Called from the compositor's thread. | 64 // Called from the compositor's thread. |
61 void DidStopFlinging(int routing_id); | 65 void DidStopFlinging(int routing_id); |
62 | 66 |
67 // Called from the compositor's thread. | |
68 void DidReceiveInputEvent(); | |
69 | |
70 // Called from the compositor's thread. | |
71 void DidAnimateForInput(); | |
72 | |
63 private: | 73 private: |
64 // Called from the compositor's thread. | 74 // Called from the compositor's thread. |
65 void AddInputHandlerOnCompositorThread( | 75 void AddInputHandlerOnCompositorThread( |
66 int routing_id, | 76 int routing_id, |
67 const scoped_refptr<base::MessageLoopProxy>& main_loop, | 77 const scoped_refptr<base::MessageLoopProxy>& main_loop, |
68 const base::WeakPtr<cc::InputHandler>& input_handler, | 78 const base::WeakPtr<cc::InputHandler>& input_handler, |
69 const base::WeakPtr<RenderViewImpl>& render_view_impl); | 79 const base::WeakPtr<RenderViewImpl>& render_view_impl); |
70 | 80 |
71 typedef base::ScopedPtrHashMap<int, // routing_id | 81 typedef base::ScopedPtrHashMap<int, // routing_id |
72 InputHandlerWrapper> InputHandlerMap; | 82 InputHandlerWrapper> InputHandlerMap; |
73 InputHandlerMap input_handlers_; | 83 InputHandlerMap input_handlers_; |
74 | 84 |
75 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 85 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
76 InputHandlerManagerClient* client_; | 86 InputHandlerManagerClient* client_; |
87 RendererScheduler* renderer_scheduler_; // Not owned. | |
77 }; | 88 }; |
78 | 89 |
79 } // namespace content | 90 } // namespace content |
80 | 91 |
81 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 92 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
OLD | NEW |