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

Side by Side Diff: content/browser/renderer_host/context_provider_factory_impl_android.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 CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_
7
8 #include <list>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/timer/timer.h"
13 #include "content/common/content_export.h"
14 #include "gpu/command_buffer/client/shared_memory_limits.h"
15 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
16 #include "ui/android/context_provider_factory.h"
17
18 namespace base {
19 template <typename T>
20 struct DefaultSingletonTraits;
21 }
22
23 namespace cc {
24 class VulkanInProcessContextProvider;
25 }
26
27 namespace gpu {
28 class GpuChannelHost;
29 }
30
31 namespace content {
32 class ContextProviderCommandBuffer;
33
34 class CONTENT_EXPORT ContextProviderFactoryImpl
35 : public ui::ContextProviderFactory {
36 public:
37 static ContextProviderFactoryImpl* GetInstance();
38
39 ~ContextProviderFactoryImpl() override;
40
41 // ContextProviderFactory implementation.
42 scoped_refptr<cc::VulkanContextProvider> GetSharedVulkanContextProvider()
43 override;
44 void RequestContextProviders(
45 gfx::AcceleratedWidget widget,
46 gpu::SharedMemoryLimits shared_memory_limits,
47 gpu::gles2::ContextCreationAttribHelper attributes,
48 bool support_locking,
49 bool automatic_flushes,
50 ContextProviderCallback result_callback) override;
51 cc::SurfaceManager* GetSurfaceManager() override;
52 uint32_t AllocateSurfaceClientId() override;
53 cc::SharedBitmapManager* GetSharedBitmapManager() override;
54 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
55
56 scoped_refptr<cc::VulkanInProcessContextProvider>
57 GetSharedVulkanContextProviderAndroid();
58
59 private:
60 friend struct base::DefaultSingletonTraits<ContextProviderFactoryImpl>;
61
62 struct ContextProvidersRequest {
63 ContextProvidersRequest();
64 ~ContextProvidersRequest();
65
66 gfx::AcceleratedWidget widget;
67 gpu::SharedMemoryLimits shared_memory_limits;
68 gpu::gles2::ContextCreationAttribHelper attributes;
69 bool support_locking;
70 bool automatic_flushes;
71 ContextProviderCallback result_callback;
72 };
73
74 ContextProviderFactoryImpl();
75
76 // Will return nullptr if the Gpu channel has not been established.
77 gpu::GpuChannelHost* EnsureGpuChannelEstablished();
78 void OnGpuChannelEstablished();
79 void OnGpuChannelTimeout();
80
81 void HandlePendingRequests();
82
83 void CreateDisplayContexts();
84
85 void CreateCompositorContexts(
86 ContextProviders& context_providers,
87 ContextProvidersRequest& context_request,
88 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host);
89
90 scoped_refptr<ContextProviderCommandBuffer>
91 SharedCompositorWorkerContextProvider(
92 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host);
93
94 std::list<ContextProvidersRequest> context_provider_requests_;
95
96 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_;
97
98 scoped_refptr<cc::VulkanContextProvider> shared_vulkan_context_provider_;
99
100 bool in_handle_pending_requests_;
101
102 base::OneShotTimer establish_gpu_channel_timeout_;
103
104 std::unique_ptr<cc::SurfaceManager> surface_manager_;
105 int surface_client_id_;
106
107 base::WeakPtrFactory<ContextProviderFactoryImpl> weak_factory_;
108
109 DISALLOW_COPY_AND_ASSIGN(ContextProviderFactoryImpl);
110 };
111
112 } // namespace content
113
114 #endif // CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698