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

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

Issue 12386078: Remove CompositorThread dependency on WebThread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 9 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
« no previous file with comments | « no previous file | content/renderer/gpu/compositor_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread.h"
12 #include "content/renderer/render_view_impl.h" 13 #include "content/renderer/render_view_impl.h"
13 #include "ipc/ipc_channel_proxy.h" 14 #include "ipc/ipc_channel_proxy.h"
14 #include "webkit/glue/webthread_impl.h"
15 15
16 namespace WebKit { 16 namespace WebKit {
17 class WebInputEvent; 17 class WebInputEvent;
18 } 18 }
19 19
20 namespace content { 20 namespace content {
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 ~CompositorThread(); 32 ~CompositorThread();
33 33
34 // This MessageFilter should be added to allow input events to be redirected 34 // This MessageFilter should be added to allow input events to be redirected
35 // to the compositor's thread. 35 // to the compositor's thread.
36 IPC::ChannelProxy::MessageFilter* GetMessageFilter() const; 36 IPC::ChannelProxy::MessageFilter* GetMessageFilter() const;
37 37
38 // Callable from the main thread only. 38 // Callable from the main thread only.
39 void AddInputHandler(int routing_id, 39 void AddInputHandler(int routing_id,
40 int input_handler_id, 40 int input_handler_id,
41 const base::WeakPtr<RenderViewImpl>& render_view_impl); 41 const base::WeakPtr<RenderViewImpl>& render_view_impl);
42 42
43 webkit_glue::WebThreadImpl* GetWebThread() { return &thread_; } 43 base::MessageLoopProxy* message_loop_proxy() const;
44
45 MessageLoop* message_loop() { return thread_.message_loop(); }
46 44
47 private: 45 private:
48 // Callback only from the compositor's thread. 46 // Callback only from the compositor's thread.
49 void RemoveInputHandler(int routing_id); 47 void RemoveInputHandler(int routing_id);
50 48
51 // Called from the compositor's thread. 49 // Called from the compositor's thread.
52 void HandleInputEvent(int routing_id, 50 void HandleInputEvent(int routing_id,
53 const WebKit::WebInputEvent* input_event); 51 const WebKit::WebInputEvent* input_event);
54 52
55 // Called from the compositor's thread. 53 // Called from the compositor's thread.
56 void AddInputHandlerOnCompositorThread( 54 void AddInputHandlerOnCompositorThread(
57 int routing_id, 55 int routing_id,
58 int input_handler_id, 56 int input_handler_id,
59 scoped_refptr<base::MessageLoopProxy> main_loop, 57 scoped_refptr<base::MessageLoopProxy> main_loop,
60 const base::WeakPtr<RenderViewImpl>& render_view_impl); 58 const base::WeakPtr<RenderViewImpl>& render_view_impl);
61 59
62 class InputHandlerWrapper; 60 class InputHandlerWrapper;
63 friend class InputHandlerWrapper; 61 friend class InputHandlerWrapper;
64 62
65 typedef std::map<int, // routing_id 63 typedef std::map<int, // routing_id
66 scoped_refptr<InputHandlerWrapper> > InputHandlerMap; 64 scoped_refptr<InputHandlerWrapper> > InputHandlerMap;
67 InputHandlerMap input_handlers_; 65 InputHandlerMap input_handlers_;
68 66
69 webkit_glue::WebThreadImpl thread_; 67 base::Thread thread_;
70 scoped_refptr<InputEventFilter> filter_; 68 scoped_refptr<InputEventFilter> filter_;
71 }; 69 };
72 70
73 } // namespace content 71 } // namespace content
74 72
75 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ 73 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/gpu/compositor_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698