| 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 void CreateArcVideoAcceleratorChannel( |
| 161 const CreateArcVideoAcceleratorChannelCallback& callback); |
| 162 |
| 157 // What kind of GPU process, e.g. sandboxed or unsandboxed. | 163 // What kind of GPU process, e.g. sandboxed or unsandboxed. |
| 158 GpuProcessKind kind(); | 164 GpuProcessKind kind(); |
| 159 | 165 |
| 160 // Forcefully terminates the GPU process. | 166 // Forcefully terminates the GPU process. |
| 161 void ForceShutdown(); | 167 void ForceShutdown(); |
| 162 | 168 |
| 163 // Asks the GPU process to stop by itself. | 169 // Asks the GPU process to stop by itself. |
| 164 void StopGpuProcess(); | 170 void StopGpuProcess(); |
| 165 | 171 |
| 166 void BeginFrameSubscription( | 172 void BeginFrameSubscription( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 189 void OnProcessLaunched() override; | 195 void OnProcessLaunched() override; |
| 190 void OnProcessLaunchFailed() override; | 196 void OnProcessLaunchFailed() override; |
| 191 void OnProcessCrashed(int exit_code) override; | 197 void OnProcessCrashed(int exit_code) override; |
| 192 ServiceRegistry* GetServiceRegistry() override; | 198 ServiceRegistry* GetServiceRegistry() override; |
| 193 | 199 |
| 194 // Message handlers. | 200 // Message handlers. |
| 195 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 201 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
| 196 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 202 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
| 197 void OnCommandBufferCreated(CreateCommandBufferResult result); | 203 void OnCommandBufferCreated(CreateCommandBufferResult result); |
| 198 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); | 204 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); |
| 205 void OnArcVideoAcceleratorChannelCreated(const IPC::ChannelHandle& handle); |
| 199 void OnDidCreateOffscreenContext(const GURL& url); | 206 void OnDidCreateOffscreenContext(const GURL& url); |
| 200 void OnDidLoseContext(bool offscreen, | 207 void OnDidLoseContext(bool offscreen, |
| 201 gpu::error::ContextLostReason reason, | 208 gpu::error::ContextLostReason reason, |
| 202 const GURL& url); | 209 const GURL& url); |
| 203 void OnDidDestroyOffscreenContext(const GURL& url); | 210 void OnDidDestroyOffscreenContext(const GURL& url); |
| 204 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); | 211 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); |
| 205 #if defined(OS_MACOSX) | 212 #if defined(OS_MACOSX) |
| 206 void OnAcceleratedSurfaceBuffersSwapped(const IPC::Message& message); | 213 void OnAcceleratedSurfaceBuffersSwapped(const IPC::Message& message); |
| 207 #endif | 214 #endif |
| 208 | 215 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 228 // These are the channel requests that we have already sent to | 235 // These are the channel requests that we have already sent to |
| 229 // the GPU process, but haven't heard back about yet. | 236 // the GPU process, but haven't heard back about yet. |
| 230 std::queue<EstablishChannelCallback> channel_requests_; | 237 std::queue<EstablishChannelCallback> channel_requests_; |
| 231 | 238 |
| 232 // The pending create command buffer requests we need to reply to. | 239 // The pending create command buffer requests we need to reply to. |
| 233 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; | 240 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; |
| 234 | 241 |
| 235 // The pending create gpu memory buffer requests we need to reply to. | 242 // The pending create gpu memory buffer requests we need to reply to. |
| 236 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; | 243 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; |
| 237 | 244 |
| 245 // The pending create arc video accelerator channel requests we need to reply |
| 246 // to. |
| 247 std::queue<CreateArcVideoAcceleratorChannelCallback> |
| 248 create_arc_video_accelerator_channel_requests_; |
| 249 |
| 238 // Qeueud messages to send when the process launches. | 250 // Qeueud messages to send when the process launches. |
| 239 std::queue<IPC::Message*> queued_messages_; | 251 std::queue<IPC::Message*> queued_messages_; |
| 240 | 252 |
| 241 // Whether the GPU process is valid, set to false after Send() failed. | 253 // Whether the GPU process is valid, set to false after Send() failed. |
| 242 bool valid_; | 254 bool valid_; |
| 243 | 255 |
| 244 // Whether we are running a GPU thread inside the browser process instead | 256 // Whether we are running a GPU thread inside the browser process instead |
| 245 // of a separate GPU process. | 257 // of a separate GPU process. |
| 246 bool in_process_; | 258 bool in_process_; |
| 247 | 259 |
| (...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 | 311 // Browser-side Mojo endpoint which sets up a Mojo channel with the child |
| 300 // process and contains the browser's ServiceRegistry. | 312 // process and contains the browser's ServiceRegistry. |
| 301 scoped_ptr<MojoApplicationHost> mojo_application_host_; | 313 scoped_ptr<MojoApplicationHost> mojo_application_host_; |
| 302 | 314 |
| 303 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 315 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 304 }; | 316 }; |
| 305 | 317 |
| 306 } // namespace content | 318 } // namespace content |
| 307 | 319 |
| 308 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 320 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |