Chromium Code Reviews| Index: ui/android/context_provider_factory.h |
| diff --git a/ui/android/context_provider_factory.h b/ui/android/context_provider_factory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1f15bbf7a85b0574ddd3874e7e9a74f5b4b078f0 |
| --- /dev/null |
| +++ b/ui/android/context_provider_factory.h |
| @@ -0,0 +1,55 @@ |
| +// 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 UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ |
| +#define UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "ui/android/ui_android_export.h" |
| + |
| +namespace cc { |
| +class ContextProvider; |
| +class VulkanContextProvider; |
| +class SurfaceManager; |
| +} |
| + |
| +namespace ui { |
| + |
| +// This class is not thread-safe and should only be accessed from the UI thread. |
| +class UI_ANDROID_EXPORT ContextProviderFactory { |
| + public: |
| + struct ContextProviders { |
| + ContextProviders(); |
| + ~ContextProviders(); |
| + |
| + scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider; |
| + |
| + scoped_refptr<cc::ContextProvider> compositor_context_provider; |
| + scoped_refptr<cc::ContextProvider> worker_context_provider; |
| + }; |
| + |
| + using ContextProviderCallback = base::Callback<void(const ContextProviders&)>; |
| + |
| + static ContextProviderFactory* GetInstance(); |
| + |
| + // This should only be called once, on startup. Ownership remains with the |
| + // caller. |
| + static void SetInstance(ContextProviderFactory* context_provider_factory); |
| + |
| + virtual ~ContextProviderFactory(){}; |
|
no sievers
2016/07/29 19:14:31
nit: space in between () and {}
|
| + |
| + // Creates a ContextProvider with an offscreen context for a compositor |
| + // rendering web content. |
| + virtual void RequestRenderContextProvider( |
|
no sievers
2016/07/29 19:14:31
nit: maybe 'CreateOffscreenContextProvider()'?
|
| + ContextProviderCallback result_callback) = 0; |
| + |
| + virtual cc::SurfaceManager* GetSurfaceManager() = 0; |
| + |
| + virtual uint32_t AllocateSurfaceClientId() = 0; |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ |