| 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 using ContextProviderCallback = |
| 36 base::Callback<void(const scoped_refptr<cc::ContextProvider>&)>; |
| 37 |
| 38 static ContextProviderFactory* GetInstance(); |
| 39 |
| 40 // This should only be called once, on startup. Ownership remains with the |
| 41 // caller. |
| 42 static void SetInstance(ContextProviderFactory* context_provider_factory); |
| 43 |
| 44 virtual ~ContextProviderFactory(){}; |
| 45 |
| 46 virtual scoped_refptr<cc::VulkanContextProvider> |
| 47 GetSharedVulkanContextProvider() = 0; |
| 48 |
| 49 // Creates an offscreen ContextProvider for the compositor. Any shared |
| 50 // contexts passed here *must* have been created using this factory. |
| 51 virtual void CreateOffscreenContextProvider( |
| 52 gpu::SharedMemoryLimits shared_memory_limits, |
| 53 gpu::gles2::ContextCreationAttribHelper attributes, |
| 54 bool support_locking, |
| 55 bool automatic_flushes, |
| 56 cc::ContextProvider* shared_context_provider, |
| 57 ContextProviderCallback result_callback) = 0; |
| 58 |
| 59 virtual cc::SurfaceManager* GetSurfaceManager() = 0; |
| 60 |
| 61 virtual uint32_t AllocateSurfaceClientId() = 0; |
| 62 |
| 63 virtual cc::SharedBitmapManager* GetSharedBitmapManager() = 0; |
| 64 |
| 65 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0; |
| 66 }; |
| 67 |
| 68 } // namespace ui |
| 69 |
| 70 #endif // UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ |
| OLD | NEW |