| 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 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 20 matching lines...) Expand all Loading... |
| 229 // These are the channel requests that we have already sent to | 238 // These are the channel requests that we have already sent to |
| 230 // the GPU process, but haven't heard back about yet. | 239 // the GPU process, but haven't heard back about yet. |
| 231 std::queue<EstablishChannelCallback> channel_requests_; | 240 std::queue<EstablishChannelCallback> channel_requests_; |
| 232 | 241 |
| 233 // The pending create command buffer requests we need to reply to. | 242 // The pending create command buffer requests we need to reply to. |
| 234 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; | 243 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; |
| 235 | 244 |
| 236 // The pending create gpu memory buffer requests we need to reply to. | 245 // The pending create gpu memory buffer requests we need to reply to. |
| 237 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; | 246 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; |
| 238 | 247 |
| 248 // The pending create arc video accelerator channel requests we need to reply |
| 249 // to. |
| 250 std::queue<CreateArcVideoAcceleratorChannelCallback> |
| 251 create_arc_video_accelerator_channel_requests_; |
| 252 |
| 239 // Qeueud messages to send when the process launches. | 253 // Qeueud messages to send when the process launches. |
| 240 std::queue<IPC::Message*> queued_messages_; | 254 std::queue<IPC::Message*> queued_messages_; |
| 241 | 255 |
| 242 // Whether the GPU process is valid, set to false after Send() failed. | 256 // Whether the GPU process is valid, set to false after Send() failed. |
| 243 bool valid_; | 257 bool valid_; |
| 244 | 258 |
| 245 // Whether we are running a GPU thread inside the browser process instead | 259 // Whether we are running a GPU thread inside the browser process instead |
| 246 // of a separate GPU process. | 260 // of a separate GPU process. |
| 247 bool in_process_; | 261 bool in_process_; |
| 248 | 262 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // Browser-side Mojo endpoint which sets up a Mojo channel with the child | 308 // Browser-side Mojo endpoint which sets up a Mojo channel with the child |
| 295 // process and contains the browser's ServiceRegistry. | 309 // process and contains the browser's ServiceRegistry. |
| 296 scoped_ptr<MojoApplicationHost> mojo_application_host_; | 310 scoped_ptr<MojoApplicationHost> mojo_application_host_; |
| 297 | 311 |
| 298 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 312 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 299 }; | 313 }; |
| 300 | 314 |
| 301 } // namespace content | 315 } // namespace content |
| 302 | 316 |
| 303 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 317 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |