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