| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_ |
| 7 |
| 8 #include <list> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/timer/timer.h" |
| 13 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/android/context_provider_factory.h" |
| 15 |
| 16 namespace base { |
| 17 template <typename T> |
| 18 struct DefaultSingletonTraits; |
| 19 } |
| 20 |
| 21 namespace cc { |
| 22 class VulkanInProcessContextProvider; |
| 23 } |
| 24 |
| 25 namespace gpu { |
| 26 class GpuChannelHost; |
| 27 } |
| 28 |
| 29 namespace content { |
| 30 class ContextProviderCommandBuffer; |
| 31 |
| 32 class CONTENT_EXPORT ContextProviderFactoryImpl |
| 33 : public ContextProviderFactory { |
| 34 public: |
| 35 using GpuChannelRequestCallback = |
| 36 base::Callback<void(scoped_refptr<gpu::GpuChannelHost>)>; |
| 37 |
| 38 static ContextProviderFactoryImpl* GetInstance(); |
| 39 |
| 40 ~ContextProviderFactoryImpl() override; |
| 41 |
| 42 void RequestRenderContextProvider( |
| 43 ContextProviderCallback result_callback) override; |
| 44 |
| 45 void RequestGpuChannel( |
| 46 GpuChannelRequestCallback gpu_channel_request_callback); |
| 47 |
| 48 scoped_refptr<cc::VulkanInProcessContextProvider> |
| 49 GetSharedVulkanContextProviderAndroid(); |
| 50 |
| 51 private: |
| 52 friend struct base::DefaultSingletonTraits<ContextProviderFactoryImpl>; |
| 53 |
| 54 ContextProviderFactoryImpl(); |
| 55 |
| 56 // Will return nullptr if the Gpu channel has not been established. |
| 57 gpu::GpuChannelHost* EnsureGpuChannelEstablished(); |
| 58 void OnGpuChannelEstablished(); |
| 59 void OnGpuChannelTimeout(); |
| 60 |
| 61 void HandlePendingRequests(); |
| 62 |
| 63 void CreateRenderCompositorContexts( |
| 64 ContextProviders& context_providers, |
| 65 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); |
| 66 |
| 67 scoped_refptr<ContextProviderCommandBuffer> |
| 68 SharedCompositorWorkerContextProvider( |
| 69 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); |
| 70 |
| 71 GpuChannelRequestCallback gpu_channel_request_callback_; |
| 72 std::list<ContextProviderCallback> render_context_request_callbacks_; |
| 73 |
| 74 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_; |
| 75 |
| 76 bool in_handle_pending_requests_; |
| 77 |
| 78 base::OneShotTimer establish_gpu_channel_timeout_; |
| 79 |
| 80 base::WeakPtrFactory<ContextProviderFactoryImpl> weak_factory_; |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(ContextProviderFactoryImpl); |
| 83 }; |
| 84 |
| 85 } // namespace content |
| 86 |
| 87 #endif // CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H
_ |
| OLD | NEW |