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

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

Issue 2297933002: blimp: Set up the CompositorDependencies for blimp in Chrome. (Closed)
Patch Set: retry gpu process failures after crbug.com/643282 Created 4 years, 3 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
« no previous file with comments | « content/test/test_render_view_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ 5 #ifndef UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_
6 #define UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ 6 #define UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "ui/android/ui_android_export.h" 10 #include "ui/android/ui_android_export.h"
11 11
12 namespace cc { 12 namespace cc {
13 class ContextProvider; 13 class ContextProvider;
14 class GpuMemoryBufferManager; 14 class GpuMemoryBufferManager;
15 class VulkanContextProvider; 15 class VulkanContextProvider;
16 class SharedBitmapManager; 16 class SharedBitmapManager;
17 class SurfaceManager; 17 class SurfaceManager;
18 } 18 }
19 19
20 namespace gpu { 20 namespace gpu {
21 namespace gles2 { 21 namespace gles2 {
22 struct ContextCreationAttribHelper; 22 struct ContextCreationAttribHelper;
23 } // namespace gles 23 } // namespace gles
24 24
25 struct SharedMemoryLimits; 25 struct SharedMemoryLimits;
26 class GpuChannelHost;
26 class GpuMemoryBufferManager; 27 class GpuMemoryBufferManager;
27 } // namespace gpu 28 } // namespace gpu
28 29
29 namespace ui { 30 namespace ui {
30 31
31 // This class is not thread-safe and should only be accessed from the UI thread. 32 // This class is not thread-safe and should only be accessed from the UI thread.
32 class UI_ANDROID_EXPORT ContextProviderFactory { 33 class UI_ANDROID_EXPORT ContextProviderFactory {
33 public: 34 public:
34 using ContextProviderCallback = 35 enum class GpuChannelHostResult {
35 base::Callback<void(const scoped_refptr<cc::ContextProvider>&)>; 36 FAILURE_GPU_PROCESS_INITIALIZATION_FAILED,
37
38 // Used when the factory is shutting down. No more requests should be made
39 // to the factory after this response is dispatched.
40 FAILURE_FACTORY_SHUTDOWN,
41
42 // Set if the Context creation was successful.
43 SUCCESS,
44 };
45
46 using GpuChannelHostCallback =
47 base::Callback<void(scoped_refptr<gpu::GpuChannelHost>,
48 GpuChannelHostResult)>;
36 49
37 enum class ContextType { 50 enum class ContextType {
38 BLIMP_RENDER_COMPOSITOR_CONTEXT, 51 BLIMP_RENDER_COMPOSITOR_CONTEXT,
39 BLIMP_RENDER_WORKER_CONTEXT, 52 BLIMP_RENDER_WORKER_CONTEXT,
40 }; 53 };
41 54
42 static ContextProviderFactory* GetInstance(); 55 static ContextProviderFactory* GetInstance();
43 56
44 // This should only be called once, on startup. Ownership remains with the 57 // This should only be called once, on startup. Ownership remains with the
45 // caller. 58 // caller.
46 static void SetInstance(ContextProviderFactory* context_provider_factory); 59 static void SetInstance(ContextProviderFactory* context_provider_factory);
47 60
48 virtual ~ContextProviderFactory(){}; 61 virtual ~ContextProviderFactory(){};
49 62
50 virtual scoped_refptr<cc::VulkanContextProvider> 63 virtual scoped_refptr<cc::VulkanContextProvider>
51 GetSharedVulkanContextProvider() = 0; 64 GetSharedVulkanContextProvider() = 0;
52 65
66 // The callback may be triggered synchronously if possible. If the creation
67 // fails, a null host is passed with the specified reason.
68 virtual void RequestGpuChannelHost(GpuChannelHostCallback callback) = 0;
69
53 // Creates an offscreen ContextProvider for the compositor. Any shared 70 // Creates an offscreen ContextProvider for the compositor. Any shared
54 // contexts passed here *must* have been created using this factory. 71 // contexts passed here *must* have been created using this factory.
55 // The callback may be triggered synchronously if possible, and will always 72 virtual scoped_refptr<cc::ContextProvider> CreateOffscreenContextProvider(
56 // have the context provider.
57 virtual void CreateOffscreenContextProvider(
58 ContextType context_type, 73 ContextType context_type,
59 gpu::SharedMemoryLimits shared_memory_limits, 74 gpu::SharedMemoryLimits shared_memory_limits,
60 gpu::gles2::ContextCreationAttribHelper attributes, 75 gpu::gles2::ContextCreationAttribHelper attributes,
61 bool support_locking, 76 bool support_locking,
62 bool automatic_flushes, 77 bool automatic_flushes,
63 cc::ContextProvider* shared_context_provider, 78 cc::ContextProvider* shared_context_provider,
64 ContextProviderCallback result_callback) = 0; 79 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) = 0;
65 80
66 virtual cc::SurfaceManager* GetSurfaceManager() = 0; 81 virtual cc::SurfaceManager* GetSurfaceManager() = 0;
67 82
68 virtual uint32_t AllocateSurfaceClientId() = 0; 83 virtual uint32_t AllocateSurfaceClientId() = 0;
69 84
70 virtual cc::SharedBitmapManager* GetSharedBitmapManager() = 0; 85 virtual cc::SharedBitmapManager* GetSharedBitmapManager() = 0;
71 86
72 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0; 87 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0;
73 }; 88 };
74 89
75 } // namespace ui 90 } // namespace ui
76 91
77 #endif // UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_ 92 #endif // UI_ANDROID_CONTEXT_PROVIDER_FACTORY_H_
OLDNEW
« no previous file with comments | « content/test/test_render_view_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698