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 SERVICES_UI_GPU_GPU_SERVICE_H_ | 5 #ifndef SERVICES_UI_GPU_GPU_SERVICE_H_ |
6 #define SERVICES_UI_GPU_GPU_SERVICE_H_ | 6 #define SERVICES_UI_GPU_GPU_SERVICE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 gpu::GpuChannelManager* gpu_channel_manager() { | 68 gpu::GpuChannelManager* gpu_channel_manager() { |
69 return gpu_channel_manager_.get(); | 69 return gpu_channel_manager_.get(); |
70 } | 70 } |
71 | 71 |
72 gpu::GpuWatchdogThread* watchdog_thread() { return watchdog_thread_.get(); } | 72 gpu::GpuWatchdogThread* watchdog_thread() { return watchdog_thread_.get(); } |
73 | 73 |
74 const gpu::GpuFeatureInfo& gpu_feature_info() const { | 74 const gpu::GpuFeatureInfo& gpu_feature_info() const { |
75 return gpu_feature_info_; | 75 return gpu_feature_info_; |
76 } | 76 } |
77 | 77 |
| 78 void set_in_host_process(bool in_host_process) { |
| 79 in_host_process_ = in_host_process; |
| 80 } |
| 81 |
78 private: | 82 private: |
79 friend class GpuMain; | 83 friend class GpuMain; |
80 | 84 |
81 gpu::SyncPointManager* sync_point_manager() { return sync_point_manager_; } | 85 gpu::SyncPointManager* sync_point_manager() { return sync_point_manager_; } |
82 | 86 |
83 gpu::gles2::MailboxManager* mailbox_manager() { | 87 gpu::gles2::MailboxManager* mailbox_manager() { |
84 return gpu_channel_manager_->mailbox_manager(); | 88 return gpu_channel_manager_->mailbox_manager(); |
85 } | 89 } |
86 | 90 |
87 gl::GLShareGroup* share_group() { | 91 gl::GLShareGroup* share_group() { |
88 return gpu_channel_manager_->share_group(); | 92 return gpu_channel_manager_->share_group(); |
89 } | 93 } |
90 | 94 |
91 const gpu::GPUInfo& gpu_info() const { return gpu_info_; } | 95 const gpu::GPUInfo& gpu_info() const { return gpu_info_; } |
92 | 96 |
| 97 void UpdateGpuInfoPlatform(); |
| 98 |
93 // gpu::GpuChannelManagerDelegate: | 99 // gpu::GpuChannelManagerDelegate: |
94 void DidCreateOffscreenContext(const GURL& active_url) override; | 100 void DidCreateOffscreenContext(const GURL& active_url) override; |
95 void DidDestroyChannel(int client_id) override; | 101 void DidDestroyChannel(int client_id) override; |
96 void DidDestroyOffscreenContext(const GURL& active_url) override; | 102 void DidDestroyOffscreenContext(const GURL& active_url) override; |
97 void DidLoseContext(bool offscreen, | 103 void DidLoseContext(bool offscreen, |
98 gpu::error::ContextLostReason reason, | 104 gpu::error::ContextLostReason reason, |
99 const GURL& active_url) override; | 105 const GURL& active_url) override; |
100 void StoreShaderToDisk(int client_id, | 106 void StoreShaderToDisk(int client_id, |
101 const std::string& key, | 107 const std::string& key, |
102 const std::string& shader) override; | 108 const std::string& shader) override; |
(...skipping 17 matching lines...) Expand all Loading... |
120 gfx::BufferFormat format, | 126 gfx::BufferFormat format, |
121 gfx::BufferUsage usage, | 127 gfx::BufferUsage usage, |
122 int client_id, | 128 int client_id, |
123 gpu::SurfaceHandle surface_handle, | 129 gpu::SurfaceHandle surface_handle, |
124 const CreateGpuMemoryBufferCallback& callback) override; | 130 const CreateGpuMemoryBufferCallback& callback) override; |
125 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 131 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
126 int client_id, | 132 int client_id, |
127 const gpu::SyncToken& sync_token) override; | 133 const gpu::SyncToken& sync_token) override; |
128 void GetVideoMemoryUsageStats( | 134 void GetVideoMemoryUsageStats( |
129 const GetVideoMemoryUsageStatsCallback& callback) override; | 135 const GetVideoMemoryUsageStatsCallback& callback) override; |
| 136 void RequestCompleteGpuInfo( |
| 137 const RequestCompleteGpuInfoCallback& callback) override; |
130 void LoadedShader(const std::string& data) override; | 138 void LoadedShader(const std::string& data) override; |
131 void DestroyingVideoSurface( | 139 void DestroyingVideoSurface( |
132 int32_t surface_id, | 140 int32_t surface_id, |
133 const DestroyingVideoSurfaceCallback& callback) override; | 141 const DestroyingVideoSurfaceCallback& callback) override; |
134 void WakeUpGpu() override; | 142 void WakeUpGpu() override; |
135 void DestroyAllChannels() override; | 143 void DestroyAllChannels() override; |
136 void Crash() override; | 144 void Crash() override; |
137 void Hang() override; | 145 void Hang() override; |
138 void ThrowJavaException() override; | 146 void ThrowJavaException() override; |
139 void Stop(const StopCallback& callback) override; | 147 void Stop(const StopCallback& callback) override; |
(...skipping 17 matching lines...) Expand all Loading... |
157 | 165 |
158 mojom::GpuHostPtr gpu_host_; | 166 mojom::GpuHostPtr gpu_host_; |
159 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; | 167 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; |
160 std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_; | 168 std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_; |
161 | 169 |
162 // On some platforms (e.g. android webview), the SyncPointManager comes from | 170 // On some platforms (e.g. android webview), the SyncPointManager comes from |
163 // external sources. | 171 // external sources. |
164 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; | 172 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; |
165 gpu::SyncPointManager* sync_point_manager_ = nullptr; | 173 gpu::SyncPointManager* sync_point_manager_ = nullptr; |
166 | 174 |
| 175 // Whether this is running in the same process as the gpu host. |
| 176 bool in_host_process_ = false; |
| 177 |
167 mojo::BindingSet<mojom::GpuService> bindings_; | 178 mojo::BindingSet<mojom::GpuService> bindings_; |
168 | 179 |
169 DISALLOW_COPY_AND_ASSIGN(GpuService); | 180 DISALLOW_COPY_AND_ASSIGN(GpuService); |
170 }; | 181 }; |
171 | 182 |
172 } // namespace ui | 183 } // namespace ui |
173 | 184 |
174 #endif // SERVICES_UI_GPU_GPU_SERVICE_H_ | 185 #endif // SERVICES_UI_GPU_GPU_SERVICE_H_ |
OLD | NEW |