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 <map> |
14 #include <queue> | 15 #include <queue> |
15 | 16 |
16 #include "base/callback.h" | 17 #include "base/callback.h" |
17 #include "base/linked_ptr.h" | 18 #include "base/linked_ptr.h" |
| 19 #include "base/ref_counted.h" |
18 #include "base/scoped_ptr.h" | 20 #include "base/scoped_ptr.h" |
19 #include "base/singleton.h" | 21 #include "base/singleton.h" |
20 #include "base/values.h" | 22 #include "base/values.h" |
21 #include "base/threading/non_thread_safe.h" | 23 #include "base/threading/non_thread_safe.h" |
22 #include "chrome/common/gpu_feature_flags.h" | 24 #include "chrome/common/gpu_feature_flags.h" |
23 #include "chrome/common/gpu_info.h" | 25 #include "chrome/common/gpu_info.h" |
24 #include "chrome/common/message_router.h" | 26 #include "chrome/common/message_router.h" |
25 #include "ipc/ipc_channel.h" | 27 #include "ipc/ipc_channel.h" |
26 #include "ui/gfx/native_widget_types.h" | 28 #include "ui/gfx/native_widget_types.h" |
27 | 29 |
28 namespace gfx { | 30 namespace gfx { |
29 class Size; | 31 class Size; |
30 } | 32 } |
31 | 33 |
32 class GpuBlacklist; | 34 class GpuBlacklist; |
33 struct GPUCreateCommandBufferConfig; | 35 struct GPUCreateCommandBufferConfig; |
34 class GPUInfo; | 36 class GPUInfo; |
35 struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params; | 37 struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params; |
36 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 38 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
37 | 39 |
38 namespace IPC { | 40 namespace IPC { |
39 struct ChannelHandle; | 41 struct ChannelHandle; |
40 class Message; | 42 class Message; |
41 } | 43 } |
42 | 44 |
| 45 class RenderWidgetHostView; |
| 46 |
43 class GpuProcessHostUIShim : public IPC::Channel::Sender, | 47 class GpuProcessHostUIShim : public IPC::Channel::Sender, |
44 public IPC::Channel::Listener, | 48 public IPC::Channel::Listener, |
45 public base::NonThreadSafe { | 49 public base::NonThreadSafe { |
46 public: | 50 public: |
47 // Getter for the singleton. This will return NULL on failure. | 51 // Getter for the singleton. This will return NULL on failure. |
48 static GpuProcessHostUIShim* GetInstance(); | 52 static GpuProcessHostUIShim* GetInstance(); |
49 | 53 |
50 int32 GetNextRoutingId(); | 54 int32 GetNextRoutingId(); |
51 | 55 |
52 // IPC::Channel::Sender implementation. | 56 // IPC::Channel::Sender implementation. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // the GPU process, but haven't heard back about yet. | 170 // the GPU process, but haven't heard back about yet. |
167 std::queue<linked_ptr<EstablishChannelCallback> > channel_requests_; | 171 std::queue<linked_ptr<EstablishChannelCallback> > channel_requests_; |
168 | 172 |
169 // The pending synchronization requests we need to reply to. | 173 // The pending synchronization requests we need to reply to. |
170 std::queue<linked_ptr<SynchronizeCallback> > synchronize_requests_; | 174 std::queue<linked_ptr<SynchronizeCallback> > synchronize_requests_; |
171 | 175 |
172 // The pending create command buffer requests we need to reply to. | 176 // The pending create command buffer requests we need to reply to. |
173 std::queue<linked_ptr<CreateCommandBufferCallback> > | 177 std::queue<linked_ptr<CreateCommandBufferCallback> > |
174 create_command_buffer_requests_; | 178 create_command_buffer_requests_; |
175 | 179 |
| 180 typedef std::pair<int32 /* renderer_id */, |
| 181 int32 /* render_view_id */> ViewID; |
| 182 |
| 183 // Encapsulates surfaces that we acquire when creating view command buffers. |
| 184 // We assume that a render view has at most 1 such surface associated |
| 185 // with it. |
| 186 class ViewSurface : public base::RefCounted<ViewSurface> { |
| 187 public: |
| 188 explicit ViewSurface(ViewID view_id); |
| 189 ~ViewSurface(); |
| 190 gfx::PluginWindowHandle surface() { return surface_; } |
| 191 private: |
| 192 RenderWidgetHostView* GetRenderWidgetHostView(); |
| 193 ViewID view_id_; |
| 194 gfx::PluginWindowHandle surface_; |
| 195 }; |
| 196 |
| 197 std::map<ViewID, scoped_refptr<ViewSurface> > acquired_surfaces_; |
| 198 |
176 bool initialized_; | 199 bool initialized_; |
177 bool initialized_successfully_; | 200 bool initialized_successfully_; |
178 | 201 |
179 bool gpu_feature_flags_set_; | 202 bool gpu_feature_flags_set_; |
180 scoped_ptr<GpuBlacklist> gpu_blacklist_; | 203 scoped_ptr<GpuBlacklist> gpu_blacklist_; |
181 GpuFeatureFlags gpu_feature_flags_; | 204 GpuFeatureFlags gpu_feature_flags_; |
182 }; | 205 }; |
183 | 206 |
184 #endif // CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ | 207 #endif // CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ |
185 | 208 |
OLD | NEW |