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 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 | |
| 12 namespace cc { | |
| 13 class ContextProvider; | |
| 14 class VulkanContextProvider; | |
| 15 class SurfaceManager; | |
| 16 } | |
| 17 | |
| 18 namespace ui { | |
| 19 | |
| 20 // This class is not thread-safe and should only be accessed from the UI thread. | |
| 21 class UI_ANDROID_EXPORT ContextProviderFactory { | |
| 22 public: | |
| 23 struct ContextProviders { | |
| 24 ContextProviders(); | |
| 25 ~ContextProviders(); | |
| 26 | |
| 27 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider; | |
| 28 | |
| 29 scoped_refptr<cc::ContextProvider> compositor_context_provider; | |
| 30 scoped_refptr<cc::ContextProvider> worker_context_provider; | |
| 31 }; | |
| 32 | |
| 33 using ContextProviderCallback = base::Callback<void(const ContextProviders&)>; | |
| 34 | |
| 35 static ContextProviderFactory* GetInstance(); | |
| 36 | |
| 37 // This should only be called once, on startup. Ownership remains with the | |
| 38 // caller. | |
| 39 static void SetInstance(ContextProviderFactory* context_provider_factory); | |
| 40 | |
| 41 virtual ~ContextProviderFactory(){}; | |
|
no sievers
2016/07/29 19:14:31
nit: space in between () and {}
| |
| 42 | |
| 43 // Creates a ContextProvider with an offscreen context for a compositor | |
| 44 // rendering web content. | |
| 45 virtual void RequestRenderContextProvider( | |
|
no sievers
2016/07/29 19:14:31
nit: maybe 'CreateOffscreenContextProvider()'?
| |
| 46 ContextProviderCallback result_callback) = 0; | |
| 47 | |
| 48 virtual cc::SurfaceManager* GetSurfaceManager() = 0; | |
| 49 | |
| 50 virtual uint32_t AllocateSurfaceClientId() = 0; | |
| 51 }; | |
| 52 | |
| 53 } // namespace ui | |
| 54 | |
| 55 #endif // UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ | |
| OLD | NEW |