OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 class ContextProviderCommandBuffer; | 34 class ContextProviderCommandBuffer; |
35 | 35 |
36 class CONTENT_EXPORT ContextProviderFactoryImpl | 36 class CONTENT_EXPORT ContextProviderFactoryImpl |
37 : public ui::ContextProviderFactory { | 37 : public ui::ContextProviderFactory { |
38 public: | 38 public: |
39 static ContextProviderFactoryImpl* GetInstance(); | 39 static ContextProviderFactoryImpl* GetInstance(); |
40 | 40 |
41 ~ContextProviderFactoryImpl() override; | 41 ~ContextProviderFactoryImpl() override; |
42 | 42 |
43 // The callback may be triggered synchronously, if the Gpu Channel is already | 43 // The callback may be triggered synchronously, if the Gpu Channel is already |
44 // initialized. In case the surface_handle is invalidated before the context | 44 // initialized. In case the context creation fails, a null context is passed |
45 // can be created, the request is dropped and the callback will *not* run. | 45 // with the failure reason. |
46 void CreateDisplayContextProvider( | 46 void CreateDisplayContextProvider( |
47 gpu::SurfaceHandle surface_handle, | 47 gpu::SurfaceHandle surface_handle, |
48 gpu::SharedMemoryLimits shared_memory_limits, | 48 gpu::SharedMemoryLimits shared_memory_limits, |
49 gpu::gles2::ContextCreationAttribHelper attributes, | 49 gpu::gles2::ContextCreationAttribHelper attributes, |
50 bool support_locking, | 50 bool support_locking, |
51 bool automatic_flushes, | 51 bool automatic_flushes, |
52 ContextProviderCallback result_callback); | 52 ContextProviderCallback result_callback); |
53 | 53 |
54 // ContextProviderFactory implementation. | 54 // ContextProviderFactory implementation. |
55 scoped_refptr<cc::VulkanContextProvider> GetSharedVulkanContextProvider() | 55 scoped_refptr<cc::VulkanContextProvider> GetSharedVulkanContextProvider() |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 gpu::gles2::ContextCreationAttribHelper attributes; | 91 gpu::gles2::ContextCreationAttribHelper attributes; |
92 bool support_locking; | 92 bool support_locking; |
93 bool automatic_flushes; | 93 bool automatic_flushes; |
94 cc::ContextProvider* shared_context_provider; | 94 cc::ContextProvider* shared_context_provider; |
95 ContextProviderCallback result_callback; | 95 ContextProviderCallback result_callback; |
96 }; | 96 }; |
97 | 97 |
98 ContextProviderFactoryImpl(); | 98 ContextProviderFactoryImpl(); |
99 | 99 |
100 // Will return nullptr if the Gpu channel has not been established. | 100 // Will return nullptr if the Gpu channel has not been established. |
101 gpu::GpuChannelHost* EnsureGpuChannelEstablished(); | 101 void EstablishGpuChannel(); |
102 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); | 102 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); |
103 void OnGpuChannelTimeout(); | 103 void OnGpuChannelTimeout(); |
104 | 104 |
105 void HandlePendingRequests(); | 105 void CheckCanHandlePendingRequests(); |
| 106 void HandlePendingRequests( |
| 107 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
| 108 ContextCreationFailureReason reason); |
106 | 109 |
107 std::list<ContextProvidersRequest> context_provider_requests_; | 110 std::list<ContextProvidersRequest> context_provider_requests_; |
108 | 111 |
109 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_; | 112 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_; |
110 | 113 |
111 scoped_refptr<cc::VulkanContextProvider> shared_vulkan_context_provider_; | 114 scoped_refptr<cc::VulkanContextProvider> shared_vulkan_context_provider_; |
112 | 115 |
113 bool in_handle_pending_requests_; | 116 bool in_handle_pending_requests_; |
114 | 117 |
115 base::OneShotTimer establish_gpu_channel_timeout_; | 118 base::OneShotTimer establish_gpu_channel_timeout_; |
116 | 119 |
117 std::unique_ptr<cc::SurfaceManager> surface_manager_; | 120 std::unique_ptr<cc::SurfaceManager> surface_manager_; |
118 int surface_client_id_; | 121 int surface_client_id_; |
119 | 122 |
120 base::WeakPtrFactory<ContextProviderFactoryImpl> weak_factory_; | 123 base::WeakPtrFactory<ContextProviderFactoryImpl> weak_factory_; |
121 | 124 |
122 DISALLOW_COPY_AND_ASSIGN(ContextProviderFactoryImpl); | 125 DISALLOW_COPY_AND_ASSIGN(ContextProviderFactoryImpl); |
123 }; | 126 }; |
124 | 127 |
125 } // namespace content | 128 } // namespace content |
126 | 129 |
127 #endif // CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H
_ | 130 #endif // CONTENT_BROWSER_RENDERER_HOST_CONTEXT_PROVIDER_FACTORY_IMPL_ANDROID_H
_ |
OLD | NEW |