| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (!factory_->CreateViewCommandBuffer(surface_id, init_params, route_id)) { |
| 146 LOG(ERROR) << "GpuChannelHost::CreateViewCommandBuffer failed."; | 146 LOG(ERROR) << "GpuChannelHost::CreateViewCommandBuffer failed."; |
| 147 |
| 148 // The most likely reason CreateViewCommandBuffer will fail is |
| 149 // that the GPU process crashed. In this case the GPU channel |
| 150 // needs to be considered lost. The caller will then set up a new |
| 151 // connection, and the GPU channel and any view command buffers |
| 152 // will all be associated with the same GPU process. |
| 153 DCHECK(MessageLoopProxy::current().get()); |
| 154 |
| 155 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy(); |
| 156 io_loop->PostTask(FROM_HERE, |
| 157 base::Bind(&GpuChannelHost::MessageFilter::OnChannelError, |
| 158 channel_filter_.get())); |
| 159 |
| 147 return NULL; | 160 return NULL; |
| 148 } | 161 } |
| 149 | 162 |
| 150 CommandBufferProxyImpl* command_buffer = | 163 CommandBufferProxyImpl* command_buffer = |
| 151 new CommandBufferProxyImpl(this, route_id); | 164 new CommandBufferProxyImpl(this, route_id); |
| 152 AddRoute(route_id, command_buffer->AsWeakPtr()); | 165 AddRoute(route_id, command_buffer->AsWeakPtr()); |
| 153 | 166 |
| 154 AutoLock lock(context_lock_); | 167 AutoLock lock(context_lock_); |
| 155 proxies_[route_id] = command_buffer; | 168 proxies_[route_id] = command_buffer; |
| 156 return command_buffer; | 169 return command_buffer; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 390 |
| 378 listeners_.clear(); | 391 listeners_.clear(); |
| 379 } | 392 } |
| 380 | 393 |
| 381 bool GpuChannelHost::MessageFilter::IsLost() const { | 394 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 382 AutoLock lock(lock_); | 395 AutoLock lock(lock_); |
| 383 return lost_; | 396 return lost_; |
| 384 } | 397 } |
| 385 | 398 |
| 386 } // namespace content | 399 } // namespace content |
| OLD | NEW |