OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GPU_GPU_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> | 72 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> |
73 EstablishChannelCallback; | 73 EstablishChannelCallback; |
74 | 74 |
75 typedef base::Callback<void(CreateCommandBufferResult)> | 75 typedef base::Callback<void(CreateCommandBufferResult)> |
76 CreateCommandBufferCallback; | 76 CreateCommandBufferCallback; |
77 | 77 |
78 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> | 78 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> |
79 CreateGpuMemoryBufferCallback; | 79 CreateGpuMemoryBufferCallback; |
80 | 80 |
| 81 typedef base::Callback<void(const IPC::ChannelHandle&)> |
| 82 CreateArcVideoAcceleratorChannelCallback; |
| 83 |
81 static bool gpu_enabled() { return gpu_enabled_; } | 84 static bool gpu_enabled() { return gpu_enabled_; } |
82 static int gpu_crash_count() { return gpu_crash_count_; } | 85 static int gpu_crash_count() { return gpu_crash_count_; } |
83 | 86 |
84 // Creates a new GpuProcessHost or gets an existing one, resulting in the | 87 // Creates a new GpuProcessHost or gets an existing one, resulting in the |
85 // launching of a GPU process if required. Returns null on failure. It | 88 // launching of a GPU process if required. Returns null on failure. It |
86 // is not safe to store the pointer once control has returned to the message | 89 // is not safe to store the pointer once control has returned to the message |
87 // loop as it can be destroyed. Instead store the associated GPU host ID. | 90 // loop as it can be destroyed. Instead store the associated GPU host ID. |
88 // This could return NULL if GPU access is not allowed (blacklisted). | 91 // This could return NULL if GPU access is not allowed (blacklisted). |
89 CONTENT_EXPORT static GpuProcessHost* Get(GpuProcessKind kind, | 92 CONTENT_EXPORT static GpuProcessHost* Get(GpuProcessKind kind, |
90 CauseForGpuLaunch cause); | 93 CauseForGpuLaunch cause); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 const gfx::Size& size, | 154 const gfx::Size& size, |
152 gfx::BufferFormat format, | 155 gfx::BufferFormat format, |
153 int client_id, | 156 int client_id, |
154 const CreateGpuMemoryBufferCallback& callback); | 157 const CreateGpuMemoryBufferCallback& callback); |
155 | 158 |
156 // Tells the GPU process to destroy GPU memory buffer. | 159 // Tells the GPU process to destroy GPU memory buffer. |
157 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 160 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
158 int client_id, | 161 int client_id, |
159 const gpu::SyncToken& sync_token); | 162 const gpu::SyncToken& sync_token); |
160 | 163 |
| 164 // Tells the GPU process to create a new ipc channel for |
| 165 // ArcVideoAccelerator. |
| 166 void CreateArcVideoAcceleratorChannel( |
| 167 const CreateArcVideoAcceleratorChannelCallback& callback); |
| 168 |
161 // What kind of GPU process, e.g. sandboxed or unsandboxed. | 169 // What kind of GPU process, e.g. sandboxed or unsandboxed. |
162 GpuProcessKind kind(); | 170 GpuProcessKind kind(); |
163 | 171 |
164 // Forcefully terminates the GPU process. | 172 // Forcefully terminates the GPU process. |
165 void ForceShutdown(); | 173 void ForceShutdown(); |
166 | 174 |
167 // Asks the GPU process to stop by itself. | 175 // Asks the GPU process to stop by itself. |
168 void StopGpuProcess(); | 176 void StopGpuProcess(); |
169 | 177 |
170 void BeginFrameSubscription( | 178 void BeginFrameSubscription( |
(...skipping 22 matching lines...) Expand all Loading... |
193 void OnProcessLaunched() override; | 201 void OnProcessLaunched() override; |
194 void OnProcessLaunchFailed() override; | 202 void OnProcessLaunchFailed() override; |
195 void OnProcessCrashed(int exit_code) override; | 203 void OnProcessCrashed(int exit_code) override; |
196 ServiceRegistry* GetServiceRegistry() override; | 204 ServiceRegistry* GetServiceRegistry() override; |
197 | 205 |
198 // Message handlers. | 206 // Message handlers. |
199 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 207 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
200 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 208 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
201 void OnCommandBufferCreated(CreateCommandBufferResult result); | 209 void OnCommandBufferCreated(CreateCommandBufferResult result); |
202 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); | 210 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); |
| 211 void OnArcVideoAcceleratorChannelCreated(const IPC::ChannelHandle& handle); |
203 void OnDidCreateOffscreenContext(const GURL& url); | 212 void OnDidCreateOffscreenContext(const GURL& url); |
204 void OnDidLoseContext(bool offscreen, | 213 void OnDidLoseContext(bool offscreen, |
205 gpu::error::ContextLostReason reason, | 214 gpu::error::ContextLostReason reason, |
206 const GURL& url); | 215 const GURL& url); |
207 void OnDidDestroyOffscreenContext(const GURL& url); | 216 void OnDidDestroyOffscreenContext(const GURL& url); |
208 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); | 217 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); |
209 #if defined(OS_MACOSX) | 218 #if defined(OS_MACOSX) |
210 void OnAcceleratedSurfaceBuffersSwapped(const IPC::Message& message); | 219 void OnAcceleratedSurfaceBuffersSwapped(const IPC::Message& message); |
211 #endif | 220 #endif |
212 | 221 |
(...skipping 20 matching lines...) Expand all Loading... |
233 // These are the channel requests that we have already sent to | 242 // These are the channel requests that we have already sent to |
234 // the GPU process, but haven't heard back about yet. | 243 // the GPU process, but haven't heard back about yet. |
235 std::queue<EstablishChannelCallback> channel_requests_; | 244 std::queue<EstablishChannelCallback> channel_requests_; |
236 | 245 |
237 // The pending create command buffer requests we need to reply to. | 246 // The pending create command buffer requests we need to reply to. |
238 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; | 247 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; |
239 | 248 |
240 // The pending create gpu memory buffer requests we need to reply to. | 249 // The pending create gpu memory buffer requests we need to reply to. |
241 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; | 250 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; |
242 | 251 |
| 252 // The pending create arc video accelerator channel requests we need to reply |
| 253 // to. |
| 254 std::queue<CreateArcVideoAcceleratorChannelCallback> |
| 255 create_arc_video_accelerator_channel_requests_; |
| 256 |
243 // Qeueud messages to send when the process launches. | 257 // Qeueud messages to send when the process launches. |
244 std::queue<IPC::Message*> queued_messages_; | 258 std::queue<IPC::Message*> queued_messages_; |
245 | 259 |
246 // Whether the GPU process is valid, set to false after Send() failed. | 260 // Whether the GPU process is valid, set to false after Send() failed. |
247 bool valid_; | 261 bool valid_; |
248 | 262 |
249 // Whether we are running a GPU thread inside the browser process instead | 263 // Whether we are running a GPU thread inside the browser process instead |
250 // of a separate GPU process. | 264 // of a separate GPU process. |
251 bool in_process_; | 265 bool in_process_; |
252 | 266 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // Browser-side Mojo endpoint which sets up a Mojo channel with the child | 318 // Browser-side Mojo endpoint which sets up a Mojo channel with the child |
305 // process and contains the browser's ServiceRegistry. | 319 // process and contains the browser's ServiceRegistry. |
306 scoped_ptr<MojoApplicationHost> mojo_application_host_; | 320 scoped_ptr<MojoApplicationHost> mojo_application_host_; |
307 | 321 |
308 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 322 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
309 }; | 323 }; |
310 | 324 |
311 } // namespace content | 325 } // namespace content |
312 | 326 |
313 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 327 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |