Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bbc842f3fa56c31df22576b6f273c37894a3977a |
| --- /dev/null |
| +++ b/content/browser/renderer_host/context_provider_factory_impl_android.h |
| @@ -0,0 +1,93 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_ |
| +#define CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_ |
| + |
| +#include <list> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/timer/timer.h" |
| +#include "content/common/content_export.h" |
| +#include "ui/android/context_provider_factory.h" |
| + |
| +namespace base { |
| +template <typename T> |
| +struct DefaultSingletonTraits; |
| +} |
| + |
| +namespace cc { |
| +class VulkanInProcessContextProvider; |
| +} |
| + |
| +namespace gpu { |
| +class GpuChannelHost; |
| +} |
| + |
| +namespace content { |
| +class ContextProviderCommandBuffer; |
| + |
| +class CONTENT_EXPORT ContextProviderFactoryImpl |
| + : public ui::ContextProviderFactory { |
| + public: |
| + using GpuChannelRequestCallback = |
| + base::Callback<void(scoped_refptr<gpu::GpuChannelHost>)>; |
| + |
| + static ContextProviderFactoryImpl* GetInstance(); |
| + |
| + ~ContextProviderFactoryImpl() override; |
| + |
| + // ContextProviderFactory implementation. |
| + void RequestRenderContextProvider( |
| + ContextProviderCallback result_callback) override; |
| + cc::SurfaceManager* GetSurfaceManager() override; |
| + uint32_t AllocateSurfaceClientId() override; |
| + |
| + void RequestGpuChannel( |
|
no sievers
2016/07/29 19:14:31
Could we maybe make this 'private' by also having
no sievers
2016/07/29 19:42:51
Ok I see now what the slightly tricky part if with
|
| + GpuChannelRequestCallback gpu_channel_request_callback); |
| + |
| + scoped_refptr<cc::VulkanInProcessContextProvider> |
| + GetSharedVulkanContextProviderAndroid(); |
| + |
| + private: |
| + friend struct base::DefaultSingletonTraits<ContextProviderFactoryImpl>; |
| + |
| + ContextProviderFactoryImpl(); |
| + |
| + // Will return nullptr if the Gpu channel has not been established. |
| + gpu::GpuChannelHost* EnsureGpuChannelEstablished(); |
| + void OnGpuChannelEstablished(); |
| + void OnGpuChannelTimeout(); |
| + |
| + void HandlePendingRequests(); |
| + |
| + void CreateRenderCompositorContexts( |
|
no sievers
2016/07/29 19:14:30
Something is a bit funky about this:
This impleme
Khushal
2016/07/29 21:30:55
Render is a bad word. I called it that because eff
|
| + ContextProviders& context_providers, |
| + scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); |
| + |
| + scoped_refptr<ContextProviderCommandBuffer> |
| + SharedCompositorWorkerContextProvider( |
| + scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); |
| + |
| + GpuChannelRequestCallback gpu_channel_request_callback_; |
| + std::list<ContextProviderCallback> render_context_request_callbacks_; |
| + |
| + scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_; |
| + |
| + bool in_handle_pending_requests_; |
| + |
| + base::OneShotTimer establish_gpu_channel_timeout_; |
| + |
| + std::unique_ptr<cc::SurfaceManager> surface_manager_; |
| + int surface_client_id_; |
| + |
| + base::WeakPtrFactory<ContextProviderFactoryImpl> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ContextProviderFactoryImpl); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_ |