Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: ui/android/context_provider_factory.h

Issue 2190033002: content: Add ContextProviderFactory to create a render ContextProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: copy ctor. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 enum class ContextType {
39 BLIMP_RENDER_COMPOSITOR_CONTEXT,
40 BLIMP_RENDER_WORKER_CONTEXT,
41 };
42
43 static ContextProviderFactory* GetInstance();
44
45 // This should only be called once, on startup. Ownership remains with the
46 // caller.
47 static void SetInstance(ContextProviderFactory* context_provider_factory);
48
49 virtual ~ContextProviderFactory(){};
50
51 virtual scoped_refptr<cc::VulkanContextProvider>
52 GetSharedVulkanContextProvider() = 0;
53
54 // Creates an offscreen ContextProvider for the compositor. Any shared
55 // contexts passed here *must* have been created using this factory.
56 virtual void CreateOffscreenContextProvider(
57 ContextType context_type,
58 gpu::SharedMemoryLimits shared_memory_limits,
59 gpu::gles2::ContextCreationAttribHelper attributes,
60 bool support_locking,
61 bool automatic_flushes,
62 cc::ContextProvider* shared_context_provider,
63 ContextProviderCallback result_callback) = 0;
64
65 virtual cc::SurfaceManager* GetSurfaceManager() = 0;
66
67 virtual uint32_t AllocateSurfaceClientId() = 0;
68
69 virtual cc::SharedBitmapManager* GetSharedBitmapManager() = 0;
70
71 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0;
72 };
73
74 } // namespace ui
75
76 #endif // UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698