OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ | 5 #ifndef CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ |
6 #define CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ | 6 #define CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // This class lives on the UI thread and supports classes like the | 9 // This class lives on the UI thread and supports classes like the |
10 // BackingStoreProxy, which must live on the UI thread. The IO thread | 10 // BackingStoreProxy, which must live on the UI thread. The IO thread |
11 // portion of this class, the GpuProcessHost, is responsible for | 11 // portion of this class, the GpuProcessHost, is responsible for |
12 // shuttling messages between the browser and GPU processes. | 12 // shuttling messages between the browser and GPU processes. |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
16 #include "base/singleton.h" | 16 #include "base/singleton.h" |
17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
18 #include "chrome/common/gpu_info.h" | 18 #include "chrome/common/gpu_info.h" |
19 #include "chrome/common/message_router.h" | 19 #include "chrome/common/message_router.h" |
20 #include "ipc/ipc_channel.h" | 20 #include "ipc/ipc_channel.h" |
21 #include "gfx/native_widget_types.h" | 21 #include "gfx/native_widget_types.h" |
22 | 22 |
| 23 namespace gfx { |
| 24 class Size; |
| 25 } |
| 26 |
| 27 struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params; |
| 28 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 29 |
23 class GpuProcessHostUIShim : public IPC::Channel::Sender, | 30 class GpuProcessHostUIShim : public IPC::Channel::Sender, |
24 public IPC::Channel::Listener, | 31 public IPC::Channel::Listener, |
25 public base::NonThreadSafe { | 32 public base::NonThreadSafe { |
26 public: | 33 public: |
27 // Getter for the singleton. This will return NULL on failure. | 34 // Getter for the singleton. This will return NULL on failure. |
28 static GpuProcessHostUIShim* GetInstance(); | 35 static GpuProcessHostUIShim* GetInstance(); |
29 | 36 |
30 int32 GetNextRoutingId(); | 37 int32 GetNextRoutingId(); |
31 | 38 |
32 // IPC::Channel::Sender implementation. | 39 // IPC::Channel::Sender implementation. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 71 } |
65 | 72 |
66 private: | 73 private: |
67 friend struct DefaultSingletonTraits<GpuProcessHostUIShim>; | 74 friend struct DefaultSingletonTraits<GpuProcessHostUIShim>; |
68 | 75 |
69 GpuProcessHostUIShim(); | 76 GpuProcessHostUIShim(); |
70 virtual ~GpuProcessHostUIShim(); | 77 virtual ~GpuProcessHostUIShim(); |
71 | 78 |
72 // Message handlers. | 79 // Message handlers. |
73 void OnGraphicsInfoCollected(const GPUInfo& gpu_info); | 80 void OnGraphicsInfoCollected(const GPUInfo& gpu_info); |
| 81 bool OnControlMessageReceived(const IPC::Message& message); |
| 82 |
| 83 #if defined(OS_LINUX) |
| 84 void OnGetViewXID(gfx::NativeViewId id, IPC::Message* reply_msg); |
| 85 void OnReleaseXID(unsigned long xid); |
| 86 void OnResizeXID(unsigned long xid, gfx::Size size, IPC::Message* reply_msg); |
| 87 #elif defined(OS_MACOSX) |
| 88 void OnAcceleratedSurfaceSetIOSurface( |
| 89 const GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params& params); |
| 90 void OnAcceleratedSurfaceBuffersSwapped( |
| 91 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); |
| 92 #elif defined(OS_WIN) |
| 93 void OnGetCompositorHostWindow(int renderer_id, |
| 94 int render_view_id, |
| 95 IPC::Message* reply_message); |
74 void OnScheduleComposite(int32 renderer_id, int32 render_view_id); | 96 void OnScheduleComposite(int32 renderer_id, int32 render_view_id); |
75 bool OnControlMessageReceived(const IPC::Message& message); | 97 #endif |
76 | 98 |
77 int last_routing_id_; | 99 int last_routing_id_; |
78 | 100 |
79 GPUInfo gpu_info_; | 101 GPUInfo gpu_info_; |
80 | 102 |
81 MessageRouter router_; | 103 MessageRouter router_; |
82 | 104 |
83 // Used only in testing. If set, the callback is invoked when the GPU info | 105 // Used only in testing. If set, the callback is invoked when the GPU info |
84 // has been collected. | 106 // has been collected. |
85 scoped_ptr<Callback0::Type> gpu_info_collected_callback_; | 107 scoped_ptr<Callback0::Type> gpu_info_collected_callback_; |
86 }; | 108 }; |
87 | 109 |
88 #endif // CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ | 110 #endif // CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ |
89 | 111 |
OLD | NEW |