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