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 #include "content/renderer/gpu/gpu_channel_host.h" | 5 #include "content/renderer/gpu/gpu_channel_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "content/common/child_process.h" | 10 #include "content/common/child_process.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return sync_filter_->Send(message); | 186 return sync_filter_->Send(message); |
187 } | 187 } |
188 | 188 |
189 // Callee takes ownership of message, regardless of whether Send is | 189 // Callee takes ownership of message, regardless of whether Send is |
190 // successful. See IPC::Message::Sender. | 190 // successful. See IPC::Message::Sender. |
191 delete message; | 191 delete message; |
192 return false; | 192 return false; |
193 } | 193 } |
194 | 194 |
195 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( | 195 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( |
196 int render_view_id, | 196 int32 surface_id, |
197 CommandBufferProxy* share_group, | 197 CommandBufferProxy* share_group, |
198 const std::string& allowed_extensions, | 198 const std::string& allowed_extensions, |
199 const std::vector<int32>& attribs, | 199 const std::vector<int32>& attribs, |
200 const GURL& active_url, | 200 const GURL& active_url, |
201 gfx::GpuPreference gpu_preference) { | 201 gfx::GpuPreference gpu_preference) { |
202 DCHECK(ChildThread::current()); | 202 DCHECK(ChildThread::current()); |
203 #if defined(ENABLE_GPU) | 203 #if defined(ENABLE_GPU) |
204 AutoLock lock(context_lock_); | 204 AutoLock lock(context_lock_); |
205 // An error occurred. Need to get the host again to reinitialize it. | 205 // An error occurred. Need to get the host again to reinitialize it. |
206 if (!channel_.get()) | 206 if (!channel_.get()) |
207 return NULL; | 207 return NULL; |
208 | 208 |
209 GPUCreateCommandBufferConfig init_params; | 209 GPUCreateCommandBufferConfig init_params; |
210 init_params.share_group_id = | 210 init_params.share_group_id = |
211 share_group ? share_group->route_id() : MSG_ROUTING_NONE; | 211 share_group ? share_group->route_id() : MSG_ROUTING_NONE; |
212 init_params.allowed_extensions = allowed_extensions; | 212 init_params.allowed_extensions = allowed_extensions; |
213 init_params.attribs = attribs; | 213 init_params.attribs = attribs; |
214 init_params.active_url = active_url; | 214 init_params.active_url = active_url; |
215 init_params.gpu_preference = gpu_preference; | 215 init_params.gpu_preference = gpu_preference; |
216 int32 route_id; | 216 int32 route_id; |
217 if (!ChildThread::current()->Send( | 217 if (!ChildThread::current()->Send( |
218 new GpuHostMsg_CreateViewCommandBuffer( | 218 new GpuHostMsg_CreateViewCommandBuffer( |
219 render_view_id, | 219 surface_id, |
220 init_params, | 220 init_params, |
221 &route_id))) { | 221 &route_id))) { |
222 return NULL; | 222 return NULL; |
223 } | 223 } |
224 | 224 |
225 if (route_id == MSG_ROUTING_NONE) | 225 if (route_id == MSG_ROUTING_NONE) |
226 return NULL; | 226 return NULL; |
227 | 227 |
228 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); | 228 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); |
229 AddRoute(route_id, command_buffer->AsWeakPtr()); | 229 AddRoute(route_id, command_buffer->AsWeakPtr()); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 &result))) { | 324 &result))) { |
325 return false; | 325 return false; |
326 } | 326 } |
327 return result; | 327 return result; |
328 } | 328 } |
329 | 329 |
330 void GpuChannelHost::ForciblyCloseChannel() { | 330 void GpuChannelHost::ForciblyCloseChannel() { |
331 Send(new GpuChannelMsg_CloseChannel()); | 331 Send(new GpuChannelMsg_CloseChannel()); |
332 SetStateLost(); | 332 SetStateLost(); |
333 } | 333 } |
OLD | NEW |