| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/renderer_host/context_provider_factory_impl_android.h" | 5 #include "content/browser/renderer_host/context_provider_factory_impl_android.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 FROM_HERE, base::TimeDelta::FromSeconds(kGpuChannelTimeoutInSeconds), | 228 FROM_HERE, base::TimeDelta::FromSeconds(kGpuChannelTimeoutInSeconds), |
| 229 this, &ContextProviderFactoryImpl::OnGpuChannelTimeout); | 229 this, &ContextProviderFactoryImpl::OnGpuChannelTimeout); |
| 230 | 230 |
| 231 return nullptr; | 231 return nullptr; |
| 232 } | 232 } |
| 233 | 233 |
| 234 void ContextProviderFactoryImpl::OnGpuChannelEstablished( | 234 void ContextProviderFactoryImpl::OnGpuChannelEstablished( |
| 235 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { | 235 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { |
| 236 establish_gpu_channel_timeout_.Stop(); | 236 establish_gpu_channel_timeout_.Stop(); |
| 237 | 237 |
| 238 // This should happen only during shutdown. So early out instead of queuing |
| 239 // more requests with the factory. |
| 240 if (!gpu_channel) |
| 241 return; |
| 242 |
| 238 // We can queue the Gpu Channel initialization requests multiple times as | 243 // We can queue the Gpu Channel initialization requests multiple times as |
| 239 // we get context requests. So we might have already handled any pending | 244 // we get context requests. So we might have already handled any pending |
| 240 // requests when this callback runs. | 245 // requests when this callback runs. |
| 241 if (!context_provider_requests_.empty()) | 246 if (!context_provider_requests_.empty()) |
| 242 HandlePendingRequests(); | 247 HandlePendingRequests(); |
| 243 } | 248 } |
| 244 | 249 |
| 245 void ContextProviderFactoryImpl::OnGpuChannelTimeout() { | 250 void ContextProviderFactoryImpl::OnGpuChannelTimeout() { |
| 246 LOG(FATAL) << "Timed out waiting for GPU channel."; | 251 LOG(FATAL) << "Timed out waiting for GPU channel."; |
| 247 } | 252 } |
| 248 | 253 |
| 249 } // namespace content | 254 } // namespace content |
| OLD | NEW |