| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 GPU_PROCESS_KIND_SANDBOXED, | 60 GPU_PROCESS_KIND_SANDBOXED, |
| 61 GPU_PROCESS_KIND_COUNT | 61 GPU_PROCESS_KIND_COUNT |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> | 64 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> |
| 65 EstablishChannelCallback; | 65 EstablishChannelCallback; |
| 66 | 66 |
| 67 typedef base::Callback<void(CreateCommandBufferResult)> | 67 typedef base::Callback<void(CreateCommandBufferResult)> |
| 68 CreateCommandBufferCallback; | 68 CreateCommandBufferCallback; |
| 69 | 69 |
| 70 typedef base::Callback<void(bool)> CreateStreamTextureCallback; |
| 71 |
| 70 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> | 72 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> |
| 71 CreateGpuMemoryBufferCallback; | 73 CreateGpuMemoryBufferCallback; |
| 72 | 74 |
| 73 static bool gpu_enabled() { return gpu_enabled_; } | 75 static bool gpu_enabled() { return gpu_enabled_; } |
| 74 static int gpu_crash_count() { return gpu_crash_count_; } | 76 static int gpu_crash_count() { return gpu_crash_count_; } |
| 75 | 77 |
| 76 // Creates a new GpuProcessHost or gets an existing one, resulting in the | 78 // Creates a new GpuProcessHost or gets an existing one, resulting in the |
| 77 // launching of a GPU process if required. Returns null on failure. It | 79 // launching of a GPU process if required. Returns null on failure. It |
| 78 // is not safe to store the pointer once control has returned to the message | 80 // is not safe to store the pointer once control has returned to the message |
| 79 // loop as it can be destroyed. Instead store the associated GPU host ID. | 81 // loop as it can be destroyed. Instead store the associated GPU host ID. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // Tells the GPU process to create a new command buffer that draws into the | 119 // Tells the GPU process to create a new command buffer that draws into the |
| 118 // given surface. | 120 // given surface. |
| 119 void CreateViewCommandBuffer( | 121 void CreateViewCommandBuffer( |
| 120 const gfx::GLSurfaceHandle& compositing_surface, | 122 const gfx::GLSurfaceHandle& compositing_surface, |
| 121 int surface_id, | 123 int surface_id, |
| 122 int client_id, | 124 int client_id, |
| 123 const GPUCreateCommandBufferConfig& init_params, | 125 const GPUCreateCommandBufferConfig& init_params, |
| 124 int route_id, | 126 int route_id, |
| 125 const CreateCommandBufferCallback& callback); | 127 const CreateCommandBufferCallback& callback); |
| 126 | 128 |
| 129 void CreateStreamTexture(int32 image_id, |
| 130 int client_id, |
| 131 int32 route_id, |
| 132 int32 stream_id, |
| 133 const CreateStreamTextureCallback& callback); |
| 134 |
| 127 // Tells the GPU process to create a new GPU memory buffer. | 135 // Tells the GPU process to create a new GPU memory buffer. |
| 128 void CreateGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 136 void CreateGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 129 const gfx::Size& size, | 137 const gfx::Size& size, |
| 130 gfx::GpuMemoryBuffer::Format format, | 138 gfx::GpuMemoryBuffer::Format format, |
| 131 gfx::GpuMemoryBuffer::Usage usage, | 139 gfx::GpuMemoryBuffer::Usage usage, |
| 132 int client_id, | 140 int client_id, |
| 133 int32 surface_id, | 141 int32 surface_id, |
| 134 const CreateGpuMemoryBufferCallback& callback); | 142 const CreateGpuMemoryBufferCallback& callback); |
| 135 | 143 |
| 136 // Tells the GPU process to destroy GPU memory buffer. | 144 // Tells the GPU process to destroy GPU memory buffer. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 163 // BrowserChildProcessHostDelegate implementation. | 171 // BrowserChildProcessHostDelegate implementation. |
| 164 bool OnMessageReceived(const IPC::Message& message) override; | 172 bool OnMessageReceived(const IPC::Message& message) override; |
| 165 void OnChannelConnected(int32 peer_pid) override; | 173 void OnChannelConnected(int32 peer_pid) override; |
| 166 void OnProcessLaunched() override; | 174 void OnProcessLaunched() override; |
| 167 void OnProcessCrashed(int exit_code) override; | 175 void OnProcessCrashed(int exit_code) override; |
| 168 | 176 |
| 169 // Message handlers. | 177 // Message handlers. |
| 170 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 178 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
| 171 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 179 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
| 172 void OnCommandBufferCreated(CreateCommandBufferResult result); | 180 void OnCommandBufferCreated(CreateCommandBufferResult result); |
| 181 void OnStreamTextureCreated(bool result); |
| 173 void OnDestroyCommandBuffer(int32 surface_id); | 182 void OnDestroyCommandBuffer(int32 surface_id); |
| 174 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); | 183 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); |
| 175 void OnDidCreateOffscreenContext(const GURL& url); | 184 void OnDidCreateOffscreenContext(const GURL& url); |
| 176 void OnDidLoseContext(bool offscreen, | 185 void OnDidLoseContext(bool offscreen, |
| 177 gpu::error::ContextLostReason reason, | 186 gpu::error::ContextLostReason reason, |
| 178 const GURL& url); | 187 const GURL& url); |
| 179 void OnDidDestroyOffscreenContext(const GURL& url); | 188 void OnDidDestroyOffscreenContext(const GURL& url); |
| 180 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); | 189 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); |
| 181 #if defined(OS_MACOSX) | 190 #if defined(OS_MACOSX) |
| 182 void OnAcceleratedSurfaceBuffersSwapped(const IPC::Message& message); | 191 void OnAcceleratedSurfaceBuffersSwapped(const IPC::Message& message); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 201 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | 210 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. |
| 202 int host_id_; | 211 int host_id_; |
| 203 | 212 |
| 204 // These are the channel requests that we have already sent to | 213 // These are the channel requests that we have already sent to |
| 205 // the GPU process, but haven't heard back about yet. | 214 // the GPU process, but haven't heard back about yet. |
| 206 std::queue<EstablishChannelCallback> channel_requests_; | 215 std::queue<EstablishChannelCallback> channel_requests_; |
| 207 | 216 |
| 208 // The pending create command buffer requests we need to reply to. | 217 // The pending create command buffer requests we need to reply to. |
| 209 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; | 218 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; |
| 210 | 219 |
| 220 // The pending create command buffer requests we need to reply to. |
| 221 std::queue<CreateStreamTextureCallback> create_stream_texture_requests_; |
| 222 |
| 211 // The pending create gpu memory buffer requests we need to reply to. | 223 // The pending create gpu memory buffer requests we need to reply to. |
| 212 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; | 224 std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_; |
| 213 | 225 |
| 214 // Surface ids for pending gpu memory buffer request refs. | 226 // Surface ids for pending gpu memory buffer request refs. |
| 215 std::queue<int32> create_gpu_memory_buffer_surface_refs_; | 227 std::queue<int32> create_gpu_memory_buffer_surface_refs_; |
| 216 | 228 |
| 217 // Qeueud messages to send when the process launches. | 229 // Qeueud messages to send when the process launches. |
| 218 std::queue<IPC::Message*> queued_messages_; | 230 std::queue<IPC::Message*> queued_messages_; |
| 219 | 231 |
| 220 // Whether the GPU process is valid, set to false after Send() failed. | 232 // Whether the GPU process is valid, set to false after Send() failed. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 // IOSurfaces. | 303 // IOSurfaces. |
| 292 IOSurfaceManagerToken io_surface_manager_token_; | 304 IOSurfaceManagerToken io_surface_manager_token_; |
| 293 #endif | 305 #endif |
| 294 | 306 |
| 295 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 307 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 296 }; | 308 }; |
| 297 | 309 |
| 298 } // namespace content | 310 } // namespace content |
| 299 | 311 |
| 300 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 312 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |