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

Side by Side Diff: content/browser/renderer_host/context_provider_factory_impl_android.h

Issue 2686243002: content/ui[Android]: Remove ContextProviderFactory. (Closed)
Patch Set: more rebase Created 3 years, 9 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 <queue>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/timer/timer.h"
13 #include "cc/surfaces/frame_sink_id_allocator.h"
14 #include "content/common/content_export.h"
15 #include "gpu/command_buffer/client/shared_memory_limits.h"
16 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
17 #include "gpu/ipc/common/surface_handle.h"
18 #include "services/ui/public/cpp/gpu/command_buffer_metrics.h"
19 #include "ui/android/context_provider_factory.h"
20
21 namespace gpu {
22 class GpuChannelHost;
23 class GpuChannelEstablishFactory;
24 }
25
26 namespace ui {
27 class ContextProviderCommandBuffer;
28 }
29
30 namespace content {
31
32 class CONTENT_EXPORT ContextProviderFactoryImpl
33 : public ui::ContextProviderFactory {
34 public:
35 // The factory must outlive the ContextProviderFactoryImpl instance, which
36 // will be destroyed when terminate is called.
37 static void Initialize(gpu::GpuChannelEstablishFactory* gpu_channel_factory);
38
39 static void Terminate();
40
41 static ContextProviderFactoryImpl* GetInstance();
42
43 ~ContextProviderFactoryImpl() override;
44
45 scoped_refptr<cc::ContextProvider> CreateDisplayContextProvider(
46 gpu::SurfaceHandle surface_handle,
47 gpu::SharedMemoryLimits shared_memory_limits,
48 gpu::gles2::ContextCreationAttribHelper attributes,
49 bool support_locking,
50 bool automatic_flushes,
51 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host);
52
53 // ContextProviderFactory implementation.
54 scoped_refptr<cc::VulkanContextProvider> GetSharedVulkanContextProvider()
55 override;
56 void RequestGpuChannelHost(GpuChannelHostCallback callback) override;
57 scoped_refptr<cc::ContextProvider> CreateOffscreenContextProvider(
58 ContextType context_type,
59 gpu::SharedMemoryLimits shared_memory_limits,
60 gpu::gles2::ContextCreationAttribHelper attributes,
61 bool support_locking,
62 bool automatic_flushes,
63 cc::ContextProvider* shared_context_provider,
64 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) override;
65 cc::SurfaceManager* GetSurfaceManager() override;
66 cc::FrameSinkId AllocateFrameSinkId() override;
67 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
68
69 private:
70 ContextProviderFactoryImpl(
71 gpu::GpuChannelEstablishFactory* gpu_channel_factory);
72
73 scoped_refptr<cc::ContextProvider> CreateContextProviderInternal(
74 ui::command_buffer_metrics::ContextType context_type,
75 gpu::SurfaceHandle surface_handle,
76 gpu::SharedMemoryLimits shared_memory_limits,
77 gpu::gles2::ContextCreationAttribHelper attributes,
78 bool support_locking,
79 bool automatic_flushes,
80 cc::ContextProvider* shared_context_provider,
81 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host);
82
83 // Will return nullptr if the Gpu channel has not been established.
84 void EstablishGpuChannel();
85 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel);
86 void OnGpuChannelTimeout();
87
88 void HandlePendingRequests(
89 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
90 GpuChannelHostResult result);
91
92 gpu::GpuChannelEstablishFactory* gpu_channel_factory_;
93
94 std::queue<GpuChannelHostCallback> gpu_channel_requests_;
95
96 scoped_refptr<ui::ContextProviderCommandBuffer>
97 shared_worker_context_provider_;
98
99 scoped_refptr<cc::VulkanContextProvider> shared_vulkan_context_provider_;
100
101 bool in_handle_pending_requests_;
102
103 bool in_shutdown_;
104
105 base::OneShotTimer establish_gpu_channel_timeout_;
106
107 std::unique_ptr<cc::SurfaceManager> surface_manager_;
108 cc::FrameSinkIdAllocator frame_sink_id_allocator_;
109
110 base::WeakPtrFactory<ContextProviderFactoryImpl> weak_factory_;
111
112 DISALLOW_COPY_AND_ASSIGN(ContextProviderFactoryImpl);
113 };
114
115 } // namespace content
116
117 #endif // CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698