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

Side by Side Diff: content/common/gpu/client/gpu_channel_host.h

Issue 11227033: Move a bunch of code in content\common (as well as a few left in renderer) to the content namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros Created 8 years, 2 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
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_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 10 matching lines...) Expand all
21 #include "content/common/message_router.h" 21 #include "content/common/message_router.h"
22 #include "content/public/common/gpu_info.h" 22 #include "content/public/common/gpu_info.h"
23 #include "ipc/ipc_channel_handle.h" 23 #include "ipc/ipc_channel_handle.h"
24 #include "ipc/ipc_channel_proxy.h" 24 #include "ipc/ipc_channel_proxy.h"
25 #include "ipc/ipc_sync_channel.h" 25 #include "ipc/ipc_sync_channel.h"
26 #include "ui/gfx/native_widget_types.h" 26 #include "ui/gfx/native_widget_types.h"
27 #include "ui/gfx/size.h" 27 #include "ui/gfx/size.h"
28 #include "ui/gl/gpu_preference.h" 28 #include "ui/gl/gpu_preference.h"
29 29
30 class CommandBufferProxy; 30 class CommandBufferProxy;
31 class CommandBufferProxyImpl; 31 class GURL;
32 class MessageLoop;
33 class TransportTextureService;
32 struct GPUCreateCommandBufferConfig; 34 struct GPUCreateCommandBufferConfig;
33 class GURL;
34 class TransportTextureService;
35 class MessageLoop;
36 35
37 namespace base { 36 namespace base {
38 class MessageLoopProxy; 37 class MessageLoopProxy;
39 } 38 }
40 39
41 namespace content {
42 struct GpuRenderingStats;
43 }
44
45 namespace IPC { 40 namespace IPC {
46 class SyncMessageFilter; 41 class SyncMessageFilter;
47 } 42 }
48 43
44 namespace content {
45 class CommandBufferProxyImpl;
46 struct GpuRenderingStats;
47
49 struct GpuListenerInfo { 48 struct GpuListenerInfo {
50 GpuListenerInfo(); 49 GpuListenerInfo();
51 ~GpuListenerInfo(); 50 ~GpuListenerInfo();
52 51
53 base::WeakPtr<IPC::Listener> listener; 52 base::WeakPtr<IPC::Listener> listener;
54 scoped_refptr<base::MessageLoopProxy> loop; 53 scoped_refptr<base::MessageLoopProxy> loop;
55 }; 54 };
56 55
57 class CONTENT_EXPORT GpuChannelHostFactory { 56 class CONTENT_EXPORT GpuChannelHostFactory {
58 public: 57 public:
59 typedef base::Callback<void(const gfx::Size)> CreateImageCallback; 58 typedef base::Callback<void(const gfx::Size)> CreateImageCallback;
60 59
61 virtual ~GpuChannelHostFactory() {} 60 virtual ~GpuChannelHostFactory() {}
62 61
63 virtual bool IsMainThread() = 0; 62 virtual bool IsMainThread() = 0;
64 virtual bool IsIOThread() = 0; 63 virtual bool IsIOThread() = 0;
65 virtual MessageLoop* GetMainLoop() = 0; 64 virtual MessageLoop* GetMainLoop() = 0;
66 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; 65 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0;
67 virtual base::WaitableEvent* GetShutDownEvent() = 0; 66 virtual base::WaitableEvent* GetShutDownEvent() = 0;
68 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(uint32 size) = 0; 67 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(uint32 size) = 0;
69 virtual int32 CreateViewCommandBuffer( 68 virtual int32 CreateViewCommandBuffer(
70 int32 surface_id, const GPUCreateCommandBufferConfig& init_params) = 0; 69 int32 surface_id, const GPUCreateCommandBufferConfig& init_params) = 0;
71 virtual GpuChannelHost* EstablishGpuChannelSync( 70 virtual GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch) = 0;
72 content::CauseForGpuLaunch) = 0;
73 virtual void CreateImage( 71 virtual void CreateImage(
74 gfx::PluginWindowHandle window, 72 gfx::PluginWindowHandle window,
75 int32 image_id, 73 int32 image_id,
76 const CreateImageCallback& callback) = 0; 74 const CreateImageCallback& callback) = 0;
77 virtual void DeleteImage(int32 image_id, int32 sync_point) = 0; 75 virtual void DeleteImage(int32 image_id, int32 sync_point) = 0;
78 }; 76 };
79 77
80 // Encapsulates an IPC channel between the client and one GPU process. 78 // Encapsulates an IPC channel between the client and one GPU process.
81 // On the GPU process side there's a corresponding GpuChannel. 79 // On the GPU process side there's a corresponding GpuChannel.
82 class GpuChannelHost : public IPC::Sender, 80 class GpuChannelHost : public IPC::Sender,
(...skipping 16 matching lines...) Expand all
99 97
100 // Connect to GPU process channel. 98 // Connect to GPU process channel.
101 void Connect(const IPC::ChannelHandle& channel_handle); 99 void Connect(const IPC::ChannelHandle& channel_handle);
102 100
103 State state() const { return state_; } 101 State state() const { return state_; }
104 102
105 // Change state to kLost. 103 // Change state to kLost.
106 void SetStateLost(); 104 void SetStateLost();
107 105
108 // The GPU stats reported by the GPU process. 106 // The GPU stats reported by the GPU process.
109 void set_gpu_info(const content::GPUInfo& gpu_info); 107 void set_gpu_info(const GPUInfo& gpu_info);
110 const content::GPUInfo& gpu_info() const; 108 const GPUInfo& gpu_info() const;
111 109
112 void OnChannelError(); 110 void OnChannelError();
113 111
114 // IPC::Sender implementation: 112 // IPC::Sender implementation:
115 virtual bool Send(IPC::Message* msg) OVERRIDE; 113 virtual bool Send(IPC::Message* msg) OVERRIDE;
116 114
117 // Create and connect to a command buffer in the GPU process. 115 // Create and connect to a command buffer in the GPU process.
118 CommandBufferProxy* CreateViewCommandBuffer( 116 CommandBufferProxy* CreateViewCommandBuffer(
119 int32 surface_id, 117 int32 surface_id,
120 CommandBufferProxy* share_group, 118 CommandBufferProxy* share_group,
(...skipping 16 matching lines...) Expand all
137 GpuVideoDecodeAcceleratorHost* CreateVideoDecoder( 135 GpuVideoDecodeAcceleratorHost* CreateVideoDecoder(
138 int command_buffer_route_id, 136 int command_buffer_route_id,
139 media::VideoCodecProfile profile, 137 media::VideoCodecProfile profile,
140 media::VideoDecodeAccelerator::Client* client); 138 media::VideoDecodeAccelerator::Client* client);
141 139
142 // Destroy a command buffer created by this channel. 140 // Destroy a command buffer created by this channel.
143 void DestroyCommandBuffer(CommandBufferProxy* command_buffer); 141 void DestroyCommandBuffer(CommandBufferProxy* command_buffer);
144 142
145 // Collect rendering stats from GPU process. 143 // Collect rendering stats from GPU process.
146 bool CollectRenderingStatsForSurface( 144 bool CollectRenderingStatsForSurface(
147 int surface_id, content::GpuRenderingStats* stats); 145 int surface_id, GpuRenderingStats* stats);
148 146
149 // Add a route for the current message loop. 147 // Add a route for the current message loop.
150 void AddRoute(int route_id, base::WeakPtr<IPC::Listener> listener); 148 void AddRoute(int route_id, base::WeakPtr<IPC::Listener> listener);
151 void RemoveRoute(int route_id); 149 void RemoveRoute(int route_id);
152 150
153 GpuChannelHostFactory* factory() const { return factory_; } 151 GpuChannelHostFactory* factory() const { return factory_; }
154 int gpu_host_id() const { return gpu_host_id_; } 152 int gpu_host_id() const { return gpu_host_id_; }
155 base::ProcessId gpu_pid() const { return channel_->peer_pid(); } 153 base::ProcessId gpu_pid() const { return channel_->peer_pid(); }
156 int client_id() const { return client_id_; } 154 int client_id() const { return client_id_; }
157 155
(...skipping 24 matching lines...) Expand all
182 typedef base::hash_map<int, GpuListenerInfo> ListenerMap; 180 typedef base::hash_map<int, GpuListenerInfo> ListenerMap;
183 ListenerMap listeners_; 181 ListenerMap listeners_;
184 }; 182 };
185 183
186 GpuChannelHostFactory* factory_; 184 GpuChannelHostFactory* factory_;
187 int client_id_; 185 int client_id_;
188 int gpu_host_id_; 186 int gpu_host_id_;
189 187
190 State state_; 188 State state_;
191 189
192 content::GPUInfo gpu_info_; 190 GPUInfo gpu_info_;
193 191
194 scoped_ptr<IPC::SyncChannel> channel_; 192 scoped_ptr<IPC::SyncChannel> channel_;
195 scoped_refptr<MessageFilter> channel_filter_; 193 scoped_refptr<MessageFilter> channel_filter_;
196 194
197 // Used to look up a proxy from its routing id. 195 // Used to look up a proxy from its routing id.
198 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; 196 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap;
199 ProxyMap proxies_; 197 ProxyMap proxies_;
200 198
201 // A lock to guard against concurrent access to members like the proxies map 199 // A lock to guard against concurrent access to members like the proxies map
202 // for calls from contexts that may live on the compositor or main thread. 200 // for calls from contexts that may live on the compositor or main thread.
203 mutable base::Lock context_lock_; 201 mutable base::Lock context_lock_;
204 202
205 // A filter for sending messages from thread other than the main thread. 203 // A filter for sending messages from thread other than the main thread.
206 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; 204 scoped_refptr<IPC::SyncMessageFilter> sync_filter_;
207 205
208 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); 206 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost);
209 }; 207 };
210 208
209 } // namespace content
210
211 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 211 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.cc ('k') | content/common/gpu/client/gpu_channel_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698