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

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

Issue 2297933002: blimp: Set up the CompositorDependencies for blimp in Chrome. (Closed)
Patch Set: change to a Gpu Channel callback 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
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 CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 24 matching lines...) Expand all
35 // The factory must outlive the ContextProviderFactoryImpl instance, which 35 // The factory must outlive the ContextProviderFactoryImpl instance, which
36 // will be destroyed when terminate is called. 36 // will be destroyed when terminate is called.
37 static void Initialize(gpu::GpuChannelEstablishFactory* gpu_channel_factory); 37 static void Initialize(gpu::GpuChannelEstablishFactory* gpu_channel_factory);
38 38
39 static void Terminate(); 39 static void Terminate();
40 40
41 static ContextProviderFactoryImpl* GetInstance(); 41 static ContextProviderFactoryImpl* GetInstance();
42 42
43 ~ContextProviderFactoryImpl() override; 43 ~ContextProviderFactoryImpl() override;
44 44
45 // The callback may be triggered synchronously, if the Gpu Channel is already 45 scoped_refptr<cc::ContextProvider> CreateDisplayContextProvider(
46 // initialized. In case the context creation fails, a null context is passed
47 // with the failure reason.
48 void CreateDisplayContextProvider(
49 gpu::SurfaceHandle surface_handle, 46 gpu::SurfaceHandle surface_handle,
50 gpu::SharedMemoryLimits shared_memory_limits, 47 gpu::SharedMemoryLimits shared_memory_limits,
51 gpu::gles2::ContextCreationAttribHelper attributes, 48 gpu::gles2::ContextCreationAttribHelper attributes,
52 bool support_locking, 49 bool support_locking,
53 bool automatic_flushes, 50 bool automatic_flushes,
54 ContextProviderCallback result_callback); 51 gpu::GpuChannelHost* gpu_channel_host);
55 52
56 // ContextProviderFactory implementation. 53 // ContextProviderFactory implementation.
57 scoped_refptr<cc::VulkanContextProvider> GetSharedVulkanContextProvider() 54 scoped_refptr<cc::VulkanContextProvider> GetSharedVulkanContextProvider()
58 override; 55 override;
59 void CreateOffscreenContextProvider( 56 void RequestGpuChannelHost(GpuChannelHostCallback callback) override;
57 scoped_refptr<cc::ContextProvider> CreateOffscreenContextProvider(
60 ContextType context_type, 58 ContextType context_type,
61 gpu::SharedMemoryLimits shared_memory_limits, 59 gpu::SharedMemoryLimits shared_memory_limits,
62 gpu::gles2::ContextCreationAttribHelper attributes, 60 gpu::gles2::ContextCreationAttribHelper attributes,
63 bool support_locking, 61 bool support_locking,
64 bool automatic_flushes, 62 bool automatic_flushes,
65 cc::ContextProvider* shared_context_provider, 63 cc::ContextProvider* shared_context_provider,
66 ContextProviderCallback result_callback) override; 64 gpu::GpuChannelHost* gpu_channel_host) override;
67 cc::SurfaceManager* GetSurfaceManager() override; 65 cc::SurfaceManager* GetSurfaceManager() override;
68 uint32_t AllocateSurfaceClientId() override; 66 uint32_t AllocateSurfaceClientId() override;
69 cc::SharedBitmapManager* GetSharedBitmapManager() override; 67 cc::SharedBitmapManager* GetSharedBitmapManager() override;
70 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; 68 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
71 69
72 private: 70 private:
73 ContextProviderFactoryImpl( 71 ContextProviderFactoryImpl(
74 gpu::GpuChannelEstablishFactory* gpu_channel_factory); 72 gpu::GpuChannelEstablishFactory* gpu_channel_factory);
75 73
76 void CreateContextProviderInternal( 74 scoped_refptr<cc::ContextProvider> CreateContextProviderInternal(
77 command_buffer_metrics::ContextType context_type, 75 command_buffer_metrics::ContextType context_type,
78 gpu::SurfaceHandle surface_handle, 76 gpu::SurfaceHandle surface_handle,
79 gpu::SharedMemoryLimits shared_memory_limits, 77 gpu::SharedMemoryLimits shared_memory_limits,
80 gpu::gles2::ContextCreationAttribHelper attributes, 78 gpu::gles2::ContextCreationAttribHelper attributes,
81 bool support_locking, 79 bool support_locking,
82 bool automatic_flushes, 80 bool automatic_flushes,
83 cc::ContextProvider* shared_context_provider, 81 cc::ContextProvider* shared_context_provider,
84 ContextProviderCallback result_callback); 82 gpu::GpuChannelHost* gpu_channel_host);
85
86 struct ContextProvidersRequest {
87 ContextProvidersRequest();
88 ContextProvidersRequest(const ContextProvidersRequest& other);
89 ~ContextProvidersRequest();
90
91 command_buffer_metrics::ContextType context_type;
92 gpu::SurfaceHandle surface_handle;
93 gpu::SharedMemoryLimits shared_memory_limits;
94 gpu::gles2::ContextCreationAttribHelper attributes;
95 bool support_locking;
96 bool automatic_flushes;
97 cc::ContextProvider* shared_context_provider;
98 ContextProviderCallback result_callback;
99 };
100 83
101 // Will return nullptr if the Gpu channel has not been established. 84 // Will return nullptr if the Gpu channel has not been established.
102 void EstablishGpuChannel(); 85 void EstablishGpuChannel();
103 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); 86 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel);
104 void OnGpuChannelTimeout(); 87 void OnGpuChannelTimeout();
105 88
106 void HandlePendingRequests( 89 void HandlePendingRequests(
107 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, 90 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
108 ContextCreationResult result); 91 GpuChannelHostResult result);
109 92
110 gpu::GpuChannelEstablishFactory* gpu_channel_factory_; 93 gpu::GpuChannelEstablishFactory* gpu_channel_factory_;
111 94
112 std::list<ContextProvidersRequest> context_provider_requests_; 95 std::list<GpuChannelHostCallback> gpu_channel_requests_;
113 96
114 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_; 97 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_;
115 98
116 scoped_refptr<cc::VulkanContextProvider> shared_vulkan_context_provider_; 99 scoped_refptr<cc::VulkanContextProvider> shared_vulkan_context_provider_;
117 100
118 bool in_handle_pending_requests_; 101 bool in_handle_pending_requests_;
119 102
120 bool in_shutdown_; 103 bool in_shutdown_;
121 104
122 base::OneShotTimer establish_gpu_channel_timeout_; 105 base::OneShotTimer establish_gpu_channel_timeout_;
123 106
124 std::unique_ptr<cc::SurfaceManager> surface_manager_; 107 std::unique_ptr<cc::SurfaceManager> surface_manager_;
125 int surface_client_id_; 108 int surface_client_id_;
126 109
127 base::WeakPtrFactory<ContextProviderFactoryImpl> weak_factory_; 110 base::WeakPtrFactory<ContextProviderFactoryImpl> weak_factory_;
128 111
129 DISALLOW_COPY_AND_ASSIGN(ContextProviderFactoryImpl); 112 DISALLOW_COPY_AND_ASSIGN(ContextProviderFactoryImpl);
130 }; 113 };
131 114
132 } // namespace content 115 } // namespace content
133 116
134 #endif // CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H _ 117 #endif // CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698