| 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 UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ |
| 6 #define UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "ui/android/ui_android_export.h" |
| 11 #include "ui/gfx/native_widget_types.h" |
| 12 |
| 13 namespace cc { |
| 14 class ContextProvider; |
| 15 class GpuMemoryBufferManager; |
| 16 class VulkanContextProvider; |
| 17 class SharedBitmapManager; |
| 18 class SurfaceManager; |
| 19 } |
| 20 |
| 21 namespace gpu { |
| 22 namespace gles2 { |
| 23 struct ContextCreationAttribHelper; |
| 24 } // namespace gles |
| 25 |
| 26 struct SharedMemoryLimits; |
| 27 class GpuMemoryBufferManager; |
| 28 } // namespace gpu |
| 29 |
| 30 namespace ui { |
| 31 |
| 32 // This class is not thread-safe and should only be accessed from the UI thread. |
| 33 class UI_ANDROID_EXPORT ContextProviderFactory { |
| 34 public: |
| 35 struct ContextProviders { |
| 36 ContextProviders(); |
| 37 ~ContextProviders(); |
| 38 scoped_refptr<cc::ContextProvider> compositor_context_provider; |
| 39 scoped_refptr<cc::ContextProvider> worker_context_provider; |
| 40 }; |
| 41 |
| 42 using ContextProviderCallback = base::Callback<void(const ContextProviders&)>; |
| 43 |
| 44 static ContextProviderFactory* GetInstance(); |
| 45 |
| 46 // This should only be called once, on startup. Ownership remains with the |
| 47 // caller. |
| 48 static void SetInstance(ContextProviderFactory* context_provider_factory); |
| 49 |
| 50 virtual ~ContextProviderFactory() {}; |
| 51 |
| 52 virtual scoped_refptr<cc::VulkanContextProvider> |
| 53 GetSharedVulkanContextProvider() = 0; |
| 54 |
| 55 // Creates a ContextProvider for the compositor. If the |widget| is |
| 56 // set, then an onscreen context for display is created, otherwise this will |
| 57 // return an offscreen context. |
| 58 virtual void CreateContextProviders( |
| 59 gfx::AcceleratedWidget widget, |
| 60 gpu::SharedMemoryLimits shared_memory_limits, |
| 61 gpu::gles2::ContextCreationAttribHelper attributes, |
| 62 bool support_locking, |
| 63 bool automatic_flushes, |
| 64 ContextProviderCallback result_callback) = 0; |
| 65 |
| 66 virtual cc::SurfaceManager* GetSurfaceManager() = 0; |
| 67 |
| 68 virtual uint32_t AllocateSurfaceClientId() = 0; |
| 69 |
| 70 virtual cc::SharedBitmapManager* GetSharedBitmapManager() = 0; |
| 71 |
| 72 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0; |
| 73 }; |
| 74 |
| 75 } // namespace ui |
| 76 |
| 77 #endif // UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ |
| OLD | NEW |