| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 factory->EstablishGpuChannel( | 224 factory->EstablishGpuChannel( |
| 225 base::Bind(&ContextProviderFactoryImpl::OnGpuChannelEstablished, | 225 base::Bind(&ContextProviderFactoryImpl::OnGpuChannelEstablished, |
| 226 weak_factory_.GetWeakPtr())); | 226 weak_factory_.GetWeakPtr())); |
| 227 establish_gpu_channel_timeout_.Start( | 227 establish_gpu_channel_timeout_.Start( |
| 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 establish_gpu_channel_timeout_.Stop(); | 236 establish_gpu_channel_timeout_.Stop(); |
| 236 | 237 |
| 237 // We can queue the Gpu Channel initialization requests multiple times as | 238 // We can queue the Gpu Channel initialization requests multiple times as |
| 238 // we get context requests. So we might have already handled any pending | 239 // we get context requests. So we might have already handled any pending |
| 239 // requests when this callback runs. | 240 // requests when this callback runs. |
| 240 if (!context_provider_requests_.empty()) | 241 if (!context_provider_requests_.empty()) |
| 241 HandlePendingRequests(); | 242 HandlePendingRequests(); |
| 242 } | 243 } |
| 243 | 244 |
| 244 void ContextProviderFactoryImpl::OnGpuChannelTimeout() { | 245 void ContextProviderFactoryImpl::OnGpuChannelTimeout() { |
| 245 LOG(FATAL) << "Timed out waiting for GPU channel."; | 246 LOG(FATAL) << "Timed out waiting for GPU channel."; |
| 246 } | 247 } |
| 247 | 248 |
| 248 } // namespace content | 249 } // namespace content |
| OLD | NEW |