OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ |
| 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/linked_ptr.h" |
| 11 #include "ipc/ipc_channel_proxy.h" |
| 12 #include "webkit/glue/webthread_impl.h" |
| 13 |
| 14 namespace WebKit { |
| 15 class WebInputEvent; |
| 16 } |
| 17 |
| 18 class InputEventFilter; |
| 19 |
| 20 // The CompositorThread class manages the background thread for the compositor. |
| 21 // The CompositorThread instance can be assumed to outlive the background |
| 22 // thread it manages. |
| 23 class CompositorThread { |
| 24 public: |
| 25 // |main_listener| refers to the central IPC message listener that lives on |
| 26 // the main thread, where all incoming IPC messages are first handled. |
| 27 explicit CompositorThread(IPC::Channel::Listener* main_listener); |
| 28 ~CompositorThread(); |
| 29 |
| 30 // This MessageFilter should be added to allow input events to be redirected |
| 31 // to the compositor's thread. |
| 32 IPC::ChannelProxy::MessageFilter* GetMessageFilter() const; |
| 33 |
| 34 // Callable from the main thread or the compositor's thread. |
| 35 void AddCompositor(int routing_id, int compositor_id); |
| 36 |
| 37 private: |
| 38 // Callback only from the compositor's thread. |
| 39 void RemoveCompositor(int routing_id); |
| 40 |
| 41 // Called from the compositor's thread. |
| 42 void HandleInputEvent(int routing_id, |
| 43 const WebKit::WebInputEvent* input_event); |
| 44 |
| 45 class CompositorWrapper; |
| 46 friend class CompositorWrapper; |
| 47 |
| 48 typedef std::map<int, // routing_id |
| 49 linked_ptr<CompositorWrapper> > CompositorMap; |
| 50 CompositorMap compositors_; |
| 51 |
| 52 webkit_glue::WebThreadImpl thread_; |
| 53 scoped_refptr<InputEventFilter> filter_; |
| 54 }; |
| 55 |
| 56 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_THREAD_H_ |
OLD | NEW |