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

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: .. 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 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(){};
no sievers 2016/08/02 20:44:34 nit: space missing in between () and {}
Khushal 2016/08/02 22:22:16 Done.
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 RequestContextProviders(
no sievers 2016/08/02 20:44:34 nit: I think 'Create' is more precise than 'Reques
Khushal 2016/08/02 22:22:16 Done.
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;
Khushal 2016/08/01 21:29:10 Added these too, we'll need them for Blimp anyway.
71
72 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0;
73 };
74
75 } // namespace ui
76
77 #endif // UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698