Index: content/browser/renderer_host/context_provider_factory_impl_android.h |
diff --git a/content/browser/renderer_host/context_provider_factory_impl_android.h b/content/browser/renderer_host/context_provider_factory_impl_android.h |
index c0fe933a6ba41c9c7cef080fb0282a69c426a167..3a820fbcb3a2fc0fb6b1abc9796b9d8ee3316dcd 100644 |
--- a/content/browser/renderer_host/context_provider_factory_impl_android.h |
+++ b/content/browser/renderer_host/context_provider_factory_impl_android.h |
@@ -17,13 +17,17 @@ |
#include "gpu/ipc/common/surface_handle.h" |
#include "ui/android/context_provider_factory.h" |
+namespace base { |
+template <typename T> |
+struct DefaultSingletonTraits; |
+} |
+ |
namespace cc { |
class VulkanInProcessContextProvider; |
} |
namespace gpu { |
class GpuChannelHost; |
-class GpuChannelEstablishFactory; |
} |
namespace content { |
@@ -32,19 +36,13 @@ |
class CONTENT_EXPORT ContextProviderFactoryImpl |
: public ui::ContextProviderFactory { |
public: |
- // The factory must outlive the ContextProviderFactoryImpl instance, which |
- // will be destroyed when terminate is called. |
- static void Initialize(gpu::GpuChannelEstablishFactory* gpu_channel_factory); |
- |
- static void Terminate(); |
- |
static ContextProviderFactoryImpl* GetInstance(); |
~ContextProviderFactoryImpl() override; |
// The callback may be triggered synchronously, if the Gpu Channel is already |
- // initialized. In case the context creation fails, a null context is passed |
- // with the failure reason. |
+ // initialized. In case the surface_handle is invalidated before the context |
+ // can be created, the request is dropped and the callback will *not* run. |
void CreateDisplayContextProvider( |
gpu::SurfaceHandle surface_handle, |
gpu::SharedMemoryLimits shared_memory_limits, |
@@ -70,8 +68,7 @@ |
gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; |
private: |
- ContextProviderFactoryImpl( |
- gpu::GpuChannelEstablishFactory* gpu_channel_factory); |
+ friend struct base::DefaultSingletonTraits<ContextProviderFactoryImpl>; |
void CreateContextProviderInternal( |
command_buffer_metrics::ContextType context_type, |
@@ -98,16 +95,14 @@ |
ContextProviderCallback result_callback; |
}; |
+ ContextProviderFactoryImpl(); |
+ |
// Will return nullptr if the Gpu channel has not been established. |
- void EstablishGpuChannel(); |
+ gpu::GpuChannelHost* EnsureGpuChannelEstablished(); |
void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); |
void OnGpuChannelTimeout(); |
- void HandlePendingRequests( |
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
- ContextCreationResult result); |
- |
- gpu::GpuChannelEstablishFactory* gpu_channel_factory_; |
+ void HandlePendingRequests(); |
std::list<ContextProvidersRequest> context_provider_requests_; |
@@ -116,8 +111,6 @@ |
scoped_refptr<cc::VulkanContextProvider> shared_vulkan_context_provider_; |
bool in_handle_pending_requests_; |
- |
- bool in_shutdown_; |
base::OneShotTimer establish_gpu_channel_timeout_; |