OLD | NEW |
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 State state() const { return state_; } | 100 State state() const { return state_; } |
101 | 101 |
102 // Change state to kLost. | 102 // Change state to kLost. |
103 void SetStateLost(); | 103 void SetStateLost(); |
104 | 104 |
105 // The GPU stats reported by the GPU process. | 105 // The GPU stats reported by the GPU process. |
106 void set_gpu_info(const GPUInfo& gpu_info); | 106 void set_gpu_info(const GPUInfo& gpu_info); |
107 const GPUInfo& gpu_info() const; | 107 const GPUInfo& gpu_info() const; |
108 | 108 |
| 109 void OnMessageReceived(const IPC::Message& message); |
109 void OnChannelError(); | 110 void OnChannelError(); |
110 | 111 |
111 // IPC::Sender implementation: | 112 // IPC::Sender implementation: |
112 virtual bool Send(IPC::Message* msg) OVERRIDE; | 113 virtual bool Send(IPC::Message* msg) OVERRIDE; |
113 | 114 |
114 // Create and connect to a command buffer in the GPU process. | 115 // Create and connect to a command buffer in the GPU process. |
115 CommandBufferProxyImpl* CreateViewCommandBuffer( | 116 CommandBufferProxyImpl* CreateViewCommandBuffer( |
116 int32 surface_id, | 117 int32 surface_id, |
117 CommandBufferProxyImpl* share_group, | 118 CommandBufferProxyImpl* share_group, |
118 const std::string& allowed_extensions, | 119 const std::string& allowed_extensions, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // Generates n unique mailbox names that can be used with | 156 // Generates n unique mailbox names that can be used with |
156 // GL_texture_mailbox_CHROMIUM. Unlike genMailboxCHROMIUM, this IPC is | 157 // GL_texture_mailbox_CHROMIUM. Unlike genMailboxCHROMIUM, this IPC is |
157 // handled only on the GPU process' IO thread, and so is not effectively | 158 // handled only on the GPU process' IO thread, and so is not effectively |
158 // a finish. | 159 // a finish. |
159 bool GenerateMailboxNames(unsigned num, std::vector<std::string>* names); | 160 bool GenerateMailboxNames(unsigned num, std::vector<std::string>* names); |
160 | 161 |
161 private: | 162 private: |
162 friend class base::RefCountedThreadSafe<GpuChannelHost>; | 163 friend class base::RefCountedThreadSafe<GpuChannelHost>; |
163 virtual ~GpuChannelHost(); | 164 virtual ~GpuChannelHost(); |
164 | 165 |
| 166 // Message handlers. |
| 167 void OnGenerateMailboxNamesReply(const std::vector<std::string>& names); |
| 168 |
165 // A filter used internally to route incoming messages from the IO thread | 169 // A filter used internally to route incoming messages from the IO thread |
166 // to the correct message loop. | 170 // to the correct message loop. |
167 class MessageFilter : public IPC::ChannelProxy::MessageFilter { | 171 class MessageFilter : public IPC::ChannelProxy::MessageFilter { |
168 public: | 172 public: |
169 explicit MessageFilter(GpuChannelHost* parent); | 173 explicit MessageFilter(GpuChannelHost* parent); |
170 | 174 |
171 void AddRoute(int route_id, | 175 void AddRoute(int route_id, |
172 base::WeakPtr<IPC::Listener> listener, | 176 base::WeakPtr<IPC::Listener> listener, |
173 scoped_refptr<base::MessageLoopProxy> loop); | 177 scoped_refptr<base::MessageLoopProxy> loop); |
174 void RemoveRoute(int route_id); | 178 void RemoveRoute(int route_id); |
(...skipping 26 matching lines...) Expand all Loading... |
201 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; | 205 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; |
202 ProxyMap proxies_; | 206 ProxyMap proxies_; |
203 | 207 |
204 // A lock to guard against concurrent access to members like the proxies map | 208 // A lock to guard against concurrent access to members like the proxies map |
205 // for calls from contexts that may live on the compositor or main thread. | 209 // for calls from contexts that may live on the compositor or main thread. |
206 mutable base::Lock context_lock_; | 210 mutable base::Lock context_lock_; |
207 | 211 |
208 // A filter for sending messages from thread other than the main thread. | 212 // A filter for sending messages from thread other than the main thread. |
209 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; | 213 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; |
210 | 214 |
| 215 // A pool of valid mailbox names. |
| 216 std::vector<std::string> mailbox_name_pool_; |
| 217 |
211 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 218 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
212 }; | 219 }; |
213 | 220 |
214 } // namespace content | 221 } // namespace content |
215 | 222 |
216 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 223 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
OLD | NEW |