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

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: Addressed comments 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 CreateContextProviders(
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 private:
57 friend struct base::DefaultSingletonTraits<ContextProviderFactoryImpl>;
58
59 struct ContextProvidersRequest {
60 ContextProvidersRequest();
61 ~ContextProvidersRequest();
62
63 gfx::AcceleratedWidget widget;
64 gpu::SharedMemoryLimits shared_memory_limits;
65 gpu::gles2::ContextCreationAttribHelper attributes;
66 bool support_locking;
67 bool automatic_flushes;
68 ContextProviderCallback result_callback;
69 };
70
71 ContextProviderFactoryImpl();
72
73 // Will return nullptr if the Gpu channel has not been established.
74 gpu::GpuChannelHost* EnsureGpuChannelEstablished();
75 void OnGpuChannelEstablished();
76 void OnGpuChannelTimeout();
77
78 void HandlePendingRequests();
79
80 void CreateDisplayContexts();
81
82 void CreateCompositorContexts(
83 ContextProviders* context_providers,
84 ContextProvidersRequest* context_request,
85 const scoped_refptr<gpu::GpuChannelHost>& gpu_channel_host);
86
87 scoped_refptr<ContextProviderCommandBuffer>
88 SharedCompositorWorkerContextProvider(
89 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host);
90
91 std::list<ContextProvidersRequest> context_provider_requests_;
92
93 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_;
94
95 scoped_refptr<cc::VulkanContextProvider> shared_vulkan_context_provider_;
96
97 bool in_handle_pending_requests_;
98
99 base::OneShotTimer establish_gpu_channel_timeout_;
100
101 std::unique_ptr<cc::SurfaceManager> surface_manager_;
102 int surface_client_id_;
103
104 base::WeakPtrFactory<ContextProviderFactoryImpl> weak_factory_;
105
106 DISALLOW_COPY_AND_ASSIGN(ContextProviderFactoryImpl);
107 };
108
109 } // namespace content
110
111 #endif // CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698