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