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 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ | 5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ |
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ | 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class InputEventFilter; | 22 class InputEventFilter; |
23 | 23 |
24 // The CompositorThread class manages the background thread for the compositor. | 24 // The CompositorThread class manages the background thread for the compositor. |
25 // The CompositorThread instance can be assumed to outlive the background | 25 // The CompositorThread instance can be assumed to outlive the background |
26 // thread it manages. | 26 // thread it manages. |
27 class CompositorThread { | 27 class CompositorThread { |
28 public: | 28 public: |
29 // |main_listener| refers to the central IPC message listener that lives on | 29 // |main_listener| refers to the central IPC message listener that lives on |
30 // the main thread, where all incoming IPC messages are first handled. | 30 // the main thread, where all incoming IPC messages are first handled. |
31 explicit CompositorThread(IPC::Listener* main_listener); | 31 explicit CompositorThread(IPC::Listener* main_listener, |
| 32 MessageLoop* message_loop); |
32 ~CompositorThread(); | 33 ~CompositorThread(); |
33 | 34 |
34 // This MessageFilter should be added to allow input events to be redirected | 35 // This MessageFilter should be added to allow input events to be redirected |
35 // to the compositor's thread. | 36 // to the compositor's thread. |
36 IPC::ChannelProxy::MessageFilter* GetMessageFilter() const; | 37 IPC::ChannelProxy::MessageFilter* GetMessageFilter() const; |
37 | 38 |
38 // Callable from the main thread only. | 39 // Callable from the main thread only. |
39 void AddInputHandler(int routing_id, | 40 void AddInputHandler(int routing_id, |
40 int input_handler_id, | 41 int input_handler_id, |
41 const base::WeakPtr<RenderViewImpl>& render_view_impl); | 42 const base::WeakPtr<RenderViewImpl>& render_view_impl); |
42 | 43 |
43 webkit_glue::WebThreadImpl* GetWebThread() { return &thread_; } | 44 webkit_glue::WebThreadImplForMessageLoop* GetWebThread() { return &thread_; } |
44 | 45 |
45 MessageLoop* message_loop() { return thread_.message_loop(); } | 46 MessageLoop* message_loop() { return message_loop_; } |
46 | 47 |
47 private: | 48 private: |
48 // Callback only from the compositor's thread. | 49 // Callback only from the compositor's thread. |
49 void RemoveInputHandler(int routing_id); | 50 void RemoveInputHandler(int routing_id); |
50 | 51 |
51 // Called from the compositor's thread. | 52 // Called from the compositor's thread. |
52 void HandleInputEvent(int routing_id, | 53 void HandleInputEvent(int routing_id, |
53 const WebKit::WebInputEvent* input_event); | 54 const WebKit::WebInputEvent* input_event); |
54 | 55 |
55 // Called from the compositor's thread. | 56 // Called from the compositor's thread. |
56 void AddInputHandlerOnCompositorThread( | 57 void AddInputHandlerOnCompositorThread( |
57 int routing_id, | 58 int routing_id, |
58 int input_handler_id, | 59 int input_handler_id, |
59 scoped_refptr<base::MessageLoopProxy> main_loop, | 60 scoped_refptr<base::MessageLoopProxy> main_loop, |
60 const base::WeakPtr<RenderViewImpl>& render_view_impl); | 61 const base::WeakPtr<RenderViewImpl>& render_view_impl); |
61 | 62 |
62 class InputHandlerWrapper; | 63 class InputHandlerWrapper; |
63 friend class InputHandlerWrapper; | 64 friend class InputHandlerWrapper; |
64 | 65 |
65 typedef std::map<int, // routing_id | 66 typedef std::map<int, // routing_id |
66 scoped_refptr<InputHandlerWrapper> > InputHandlerMap; | 67 scoped_refptr<InputHandlerWrapper> > InputHandlerMap; |
67 InputHandlerMap input_handlers_; | 68 InputHandlerMap input_handlers_; |
68 | 69 |
69 webkit_glue::WebThreadImpl thread_; | 70 MessageLoop* message_loop_; |
| 71 webkit_glue::WebThreadImplForMessageLoop thread_; |
70 scoped_refptr<InputEventFilter> filter_; | 72 scoped_refptr<InputEventFilter> filter_; |
71 }; | 73 }; |
72 | 74 |
73 } // namespace content | 75 } // namespace content |
74 | 76 |
75 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ | 77 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ |
OLD | NEW |