Chromium Code Reviews| 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 "ui/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 ui::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 // ContextProviderFactory implementation. | |
| 43 void RequestRenderContextProvider( | |
| 44 ContextProviderCallback result_callback) override; | |
| 45 cc::SurfaceManager* GetSurfaceManager() override; | |
| 46 uint32_t AllocateSurfaceClientId() override; | |
| 47 | |
| 48 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
| |
| 49 GpuChannelRequestCallback gpu_channel_request_callback); | |
| 50 | |
| 51 scoped_refptr<cc::VulkanInProcessContextProvider> | |
| 52 GetSharedVulkanContextProviderAndroid(); | |
| 53 | |
| 54 private: | |
| 55 friend struct base::DefaultSingletonTraits<ContextProviderFactoryImpl>; | |
| 56 | |
| 57 ContextProviderFactoryImpl(); | |
| 58 | |
| 59 // Will return nullptr if the Gpu channel has not been established. | |
| 60 gpu::GpuChannelHost* EnsureGpuChannelEstablished(); | |
| 61 void OnGpuChannelEstablished(); | |
| 62 void OnGpuChannelTimeout(); | |
| 63 | |
| 64 void HandlePendingRequests(); | |
| 65 | |
| 66 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
| |
| 67 ContextProviders& context_providers, | |
| 68 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); | |
| 69 | |
| 70 scoped_refptr<ContextProviderCommandBuffer> | |
| 71 SharedCompositorWorkerContextProvider( | |
| 72 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); | |
| 73 | |
| 74 GpuChannelRequestCallback gpu_channel_request_callback_; | |
| 75 std::list<ContextProviderCallback> render_context_request_callbacks_; | |
| 76 | |
| 77 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_; | |
| 78 | |
| 79 bool in_handle_pending_requests_; | |
| 80 | |
| 81 base::OneShotTimer establish_gpu_channel_timeout_; | |
| 82 | |
| 83 std::unique_ptr<cc::SurfaceManager> surface_manager_; | |
| 84 int surface_client_id_; | |
| 85 | |
| 86 base::WeakPtrFactory<ContextProviderFactoryImpl> weak_factory_; | |
| 87 | |
| 88 DISALLOW_COPY_AND_ASSIGN(ContextProviderFactoryImpl); | |
| 89 }; | |
| 90 | |
| 91 } // namespace content | |
| 92 | |
| 93 #endif // CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H _ | |
| OLD | NEW |