| 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/common/gpu/client/gpu_channel_host.h" | 5 #include "content/common/gpu/client/gpu_channel_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 "surface_id", | 135 "surface_id", |
| 136 surface_id); | 136 surface_id); |
| 137 | 137 |
| 138 GPUCreateCommandBufferConfig init_params; | 138 GPUCreateCommandBufferConfig init_params; |
| 139 init_params.share_group_id = | 139 init_params.share_group_id = |
| 140 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; | 140 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; |
| 141 init_params.attribs = attribs; | 141 init_params.attribs = attribs; |
| 142 init_params.active_url = active_url; | 142 init_params.active_url = active_url; |
| 143 init_params.gpu_preference = gpu_preference; | 143 init_params.gpu_preference = gpu_preference; |
| 144 int32 route_id = GenerateRouteID(); | 144 int32 route_id = GenerateRouteID(); |
| 145 if (!factory_->CreateViewCommandBuffer(surface_id, init_params, route_id)) { | 145 CreateCommandBufferResult result = factory_->CreateViewCommandBuffer( |
| 146 surface_id, init_params, route_id); |
| 147 if (result != CREATE_COMMAND_BUFFER_SUCCEEDED) { |
| 146 LOG(ERROR) << "GpuChannelHost::CreateViewCommandBuffer failed."; | 148 LOG(ERROR) << "GpuChannelHost::CreateViewCommandBuffer failed."; |
| 147 | 149 |
| 148 // The most likely reason CreateViewCommandBuffer will fail is | 150 if (result == CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST) { |
| 149 // that the GPU process crashed. In this case the GPU channel | 151 // The GPU channel needs to be considered lost. The caller will |
| 150 // needs to be considered lost. The caller will then set up a new | 152 // then set up a new connection, and the GPU channel and any |
| 151 // connection, and the GPU channel and any view command buffers | 153 // view command buffers will all be associated with the same GPU |
| 152 // will all be associated with the same GPU process. | 154 // process. |
| 153 DCHECK(MessageLoopProxy::current().get()); | 155 DCHECK(MessageLoopProxy::current().get()); |
| 154 | 156 |
| 155 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy(); | 157 scoped_refptr<base::MessageLoopProxy> io_loop = |
| 156 io_loop->PostTask(FROM_HERE, | 158 factory_->GetIOLoopProxy(); |
| 157 base::Bind(&GpuChannelHost::MessageFilter::OnChannelError, | 159 io_loop->PostTask( |
| 158 channel_filter_.get())); | 160 FROM_HERE, |
| 161 base::Bind(&GpuChannelHost::MessageFilter::OnChannelError, |
| 162 channel_filter_.get())); |
| 163 } |
| 159 | 164 |
| 160 return NULL; | 165 return NULL; |
| 161 } | 166 } |
| 162 | 167 |
| 163 CommandBufferProxyImpl* command_buffer = | 168 CommandBufferProxyImpl* command_buffer = |
| 164 new CommandBufferProxyImpl(this, route_id); | 169 new CommandBufferProxyImpl(this, route_id); |
| 165 AddRoute(route_id, command_buffer->AsWeakPtr()); | 170 AddRoute(route_id, command_buffer->AsWeakPtr()); |
| 166 | 171 |
| 167 AutoLock lock(context_lock_); | 172 AutoLock lock(context_lock_); |
| 168 proxies_[route_id] = command_buffer; | 173 proxies_[route_id] = command_buffer; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 395 |
| 391 listeners_.clear(); | 396 listeners_.clear(); |
| 392 } | 397 } |
| 393 | 398 |
| 394 bool GpuChannelHost::MessageFilter::IsLost() const { | 399 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 395 AutoLock lock(lock_); | 400 AutoLock lock(lock_); |
| 396 return lost_; | 401 return lost_; |
| 397 } | 402 } |
| 398 | 403 |
| 399 } // namespace content | 404 } // namespace content |
| OLD | NEW |