OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ |
| 6 #define CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ |
| 7 |
| 8 // This class lives on the UI thread and supports classes like the |
| 9 // BackingStoreProxy, which must live on the UI thread. The IO thread |
| 10 // portion of this class, the GpuProcessHost, is responsible for |
| 11 // shuttling messages between the browser and GPU processes. |
| 12 |
| 13 #include "base/singleton.h" |
| 14 #include "chrome/common/gpu_native_window_handle.h" |
| 15 #include "chrome/common/message_router.h" |
| 16 #include "ipc/ipc_channel.h" |
| 17 #include "gfx/native_widget_types.h" |
| 18 |
| 19 class GpuProcessHostUIShim : public IPC::Channel::Sender, |
| 20 public IPC::Channel::Listener { |
| 21 public: |
| 22 // Getter for the singleton. This will return NULL on failure. |
| 23 static GpuProcessHostUIShim* Get(); |
| 24 |
| 25 int32 GetNextRoutingId(); |
| 26 |
| 27 // Creates the new remote view and returns the routing ID for the view, or 0 |
| 28 // on failure. |
| 29 int32 NewRenderWidgetHostView(GpuNativeWindowHandle parent); |
| 30 |
| 31 // IPC::Channel::Sender implementation. |
| 32 virtual bool Send(IPC::Message* msg); |
| 33 |
| 34 // IPC::Channel::Listener implementation. |
| 35 // The GpuProcessHost causes this to be called on the UI thread to |
| 36 // dispatch the incoming messages from the GPU process, which are |
| 37 // actually received on the IO thread. |
| 38 virtual void OnMessageReceived(const IPC::Message& message); |
| 39 |
| 40 // See documentation on MessageRouter for AddRoute and RemoveRoute |
| 41 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); |
| 42 void RemoveRoute(int32 routing_id); |
| 43 |
| 44 private: |
| 45 friend struct DefaultSingletonTraits<GpuProcessHostUIShim>; |
| 46 |
| 47 GpuProcessHostUIShim(); |
| 48 virtual ~GpuProcessHostUIShim(); |
| 49 |
| 50 int last_routing_id_; |
| 51 |
| 52 MessageRouter router_; |
| 53 }; |
| 54 |
| 55 #endif // CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ |
| 56 |
OLD | NEW |