| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 return sync_filter_->Send(message); | 175 return sync_filter_->Send(message); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // Callee takes ownership of message, regardless of whether Send is | 178 // Callee takes ownership of message, regardless of whether Send is |
| 179 // successful. See IPC::Message::Sender. | 179 // successful. See IPC::Message::Sender. |
| 180 delete message; | 180 delete message; |
| 181 return false; | 181 return false; |
| 182 } | 182 } |
| 183 | 183 |
| 184 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( | 184 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( |
| 185 int render_view_id, | 185 int32 surface_id, |
| 186 CommandBufferProxy* share_group, | 186 CommandBufferProxy* share_group, |
| 187 const std::string& allowed_extensions, | 187 const std::string& allowed_extensions, |
| 188 const std::vector<int32>& attribs, | 188 const std::vector<int32>& attribs, |
| 189 const GURL& active_url, | 189 const GURL& active_url, |
| 190 gfx::GpuPreference gpu_preference) { | 190 gfx::GpuPreference gpu_preference) { |
| 191 DCHECK(ChildThread::current()); | 191 DCHECK(ChildThread::current()); |
| 192 #if defined(ENABLE_GPU) | 192 #if defined(ENABLE_GPU) |
| 193 AutoLock lock(context_lock_); | 193 AutoLock lock(context_lock_); |
| 194 // An error occurred. Need to get the host again to reinitialize it. | 194 // An error occurred. Need to get the host again to reinitialize it. |
| 195 if (!channel_.get()) | 195 if (!channel_.get()) |
| 196 return NULL; | 196 return NULL; |
| 197 | 197 |
| 198 GPUCreateCommandBufferConfig init_params; | 198 GPUCreateCommandBufferConfig init_params; |
| 199 init_params.share_group_id = | 199 init_params.share_group_id = |
| 200 share_group ? share_group->route_id() : MSG_ROUTING_NONE; | 200 share_group ? share_group->route_id() : MSG_ROUTING_NONE; |
| 201 init_params.allowed_extensions = allowed_extensions; | 201 init_params.allowed_extensions = allowed_extensions; |
| 202 init_params.attribs = attribs; | 202 init_params.attribs = attribs; |
| 203 init_params.active_url = active_url; | 203 init_params.active_url = active_url; |
| 204 init_params.gpu_preference = gpu_preference; | 204 init_params.gpu_preference = gpu_preference; |
| 205 int32 route_id; | 205 int32 route_id; |
| 206 if (!ChildThread::current()->Send( | 206 if (!ChildThread::current()->Send( |
| 207 new GpuHostMsg_CreateViewCommandBuffer( | 207 new GpuHostMsg_CreateViewCommandBuffer( |
| 208 render_view_id, | 208 surface_id, |
| 209 init_params, | 209 init_params, |
| 210 &route_id))) { | 210 &route_id))) { |
| 211 return NULL; | 211 return NULL; |
| 212 } | 212 } |
| 213 | 213 |
| 214 if (route_id == MSG_ROUTING_NONE) | 214 if (route_id == MSG_ROUTING_NONE) |
| 215 return NULL; | 215 return NULL; |
| 216 | 216 |
| 217 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); | 217 CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id); |
| 218 AddRoute(route_id, command_buffer->AsWeakPtr()); | 218 AddRoute(route_id, command_buffer->AsWeakPtr()); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 &result))) { | 313 &result))) { |
| 314 return false; | 314 return false; |
| 315 } | 315 } |
| 316 return result; | 316 return result; |
| 317 } | 317 } |
| 318 | 318 |
| 319 void GpuChannelHost::ForciblyCloseChannel() { | 319 void GpuChannelHost::ForciblyCloseChannel() { |
| 320 Send(new GpuChannelMsg_CloseChannel()); | 320 Send(new GpuChannelMsg_CloseChannel()); |
| 321 SetStateLost(); | 321 SetStateLost(); |
| 322 } | 322 } |
| OLD | NEW |