| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 GPU_PROCESS_KIND_COUNT | 56 GPU_PROCESS_KIND_COUNT |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> | 59 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> |
| 60 EstablishChannelCallback; | 60 EstablishChannelCallback; |
| 61 | 61 |
| 62 typedef base::Callback<void(int32)> CreateCommandBufferCallback; | 62 typedef base::Callback<void(int32)> CreateCommandBufferCallback; |
| 63 | 63 |
| 64 typedef base::Callback<void(const gfx::Size)> CreateImageCallback; | 64 typedef base::Callback<void(const gfx::Size)> CreateImageCallback; |
| 65 | 65 |
| 66 typedef base::Closure CreateSurfaceTextureCallback; |
| 67 |
| 66 static bool gpu_enabled() { return gpu_enabled_; } | 68 static bool gpu_enabled() { return gpu_enabled_; } |
| 67 | 69 |
| 68 // Creates a new GpuProcessHost or gets an existing one, resulting in the | 70 // Creates a new GpuProcessHost or gets an existing one, resulting in the |
| 69 // launching of a GPU process if required. Returns null on failure. It | 71 // launching of a GPU process if required. Returns null on failure. It |
| 70 // is not safe to store the pointer once control has returned to the message | 72 // is not safe to store the pointer once control has returned to the message |
| 71 // loop as it can be destroyed. Instead store the associated GPU host ID. | 73 // loop as it can be destroyed. Instead store the associated GPU host ID. |
| 72 // This could return NULL if GPU access is not allowed (blacklisted). | 74 // This could return NULL if GPU access is not allowed (blacklisted). |
| 73 CONTENT_EXPORT static GpuProcessHost* Get(GpuProcessKind kind, | 75 CONTENT_EXPORT static GpuProcessHost* Get(GpuProcessKind kind, |
| 74 CauseForGpuLaunch cause); | 76 CauseForGpuLaunch cause); |
| 75 | 77 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // Tells the GPU process to create a new image using the given window. | 119 // Tells the GPU process to create a new image using the given window. |
| 118 void CreateImage( | 120 void CreateImage( |
| 119 gfx::PluginWindowHandle window, | 121 gfx::PluginWindowHandle window, |
| 120 int client_id, | 122 int client_id, |
| 121 int image_id, | 123 int image_id, |
| 122 const CreateImageCallback& callback); | 124 const CreateImageCallback& callback); |
| 123 | 125 |
| 124 // Tells the GPU process to delete image. | 126 // Tells the GPU process to delete image. |
| 125 void DeleteImage(int client_id, int image_id, int sync_point); | 127 void DeleteImage(int client_id, int image_id, int sync_point); |
| 126 | 128 |
| 129 // Tells the GPU process to create a new surface texture using the given id. |
| 130 void CreateSurfaceTexture( |
| 131 int surface_texture_id, |
| 132 base::ProcessHandle process_handle, |
| 133 const CreateSurfaceTextureCallback& callback); |
| 134 |
| 127 // What kind of GPU process, e.g. sandboxed or unsandboxed. | 135 // What kind of GPU process, e.g. sandboxed or unsandboxed. |
| 128 GpuProcessKind kind(); | 136 GpuProcessKind kind(); |
| 129 | 137 |
| 130 void ForceShutdown(); | 138 void ForceShutdown(); |
| 131 | 139 |
| 132 void BeginFrameSubscription( | 140 void BeginFrameSubscription( |
| 133 int surface_id, | 141 int surface_id, |
| 134 base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber); | 142 base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber); |
| 135 void EndFrameSubscription(int surface_id); | 143 void EndFrameSubscription(int surface_id); |
| 136 void LoadedShader(const std::string& key, const std::string& data); | 144 void LoadedShader(const std::string& key, const std::string& data); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 151 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 159 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
| 152 virtual void OnProcessLaunched() OVERRIDE; | 160 virtual void OnProcessLaunched() OVERRIDE; |
| 153 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 161 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
| 154 | 162 |
| 155 // Message handlers. | 163 // Message handlers. |
| 156 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 164 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
| 157 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 165 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
| 158 void OnCommandBufferCreated(const int32 route_id); | 166 void OnCommandBufferCreated(const int32 route_id); |
| 159 void OnDestroyCommandBuffer(int32 surface_id); | 167 void OnDestroyCommandBuffer(int32 surface_id); |
| 160 void OnImageCreated(const gfx::Size size); | 168 void OnImageCreated(const gfx::Size size); |
| 169 void OnSurfaceTextureCreated(); |
| 161 void OnDidCreateOffscreenContext(const GURL& url); | 170 void OnDidCreateOffscreenContext(const GURL& url); |
| 162 void OnDidLoseContext(bool offscreen, | 171 void OnDidLoseContext(bool offscreen, |
| 163 gpu::error::ContextLostReason reason, | 172 gpu::error::ContextLostReason reason, |
| 164 const GURL& url); | 173 const GURL& url); |
| 165 void OnDidDestroyOffscreenContext(const GURL& url); | 174 void OnDidDestroyOffscreenContext(const GURL& url); |
| 166 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); | 175 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); |
| 167 #if defined(OS_MACOSX) | 176 #if defined(OS_MACOSX) |
| 168 void OnAcceleratedSurfaceBuffersSwapped( | 177 void OnAcceleratedSurfaceBuffersSwapped( |
| 169 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); | 178 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); |
| 170 #endif | 179 #endif |
| (...skipping 27 matching lines...) Expand all Loading... |
| 198 // These are the channel requests that we have already sent to | 207 // These are the channel requests that we have already sent to |
| 199 // the GPU process, but haven't heard back about yet. | 208 // the GPU process, but haven't heard back about yet. |
| 200 std::queue<EstablishChannelCallback> channel_requests_; | 209 std::queue<EstablishChannelCallback> channel_requests_; |
| 201 | 210 |
| 202 // The pending create command buffer requests we need to reply to. | 211 // The pending create command buffer requests we need to reply to. |
| 203 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; | 212 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; |
| 204 | 213 |
| 205 // The pending create image requests we need to reply to. | 214 // The pending create image requests we need to reply to. |
| 206 std::queue<CreateImageCallback> create_image_requests_; | 215 std::queue<CreateImageCallback> create_image_requests_; |
| 207 | 216 |
| 217 // The pending create surface texture requests we need to reply to. |
| 218 std::queue<CreateSurfaceTextureCallback> create_surface_texture_requests_; |
| 208 | 219 |
| 209 // Qeueud messages to send when the process launches. | 220 // Qeueud messages to send when the process launches. |
| 210 std::queue<IPC::Message*> queued_messages_; | 221 std::queue<IPC::Message*> queued_messages_; |
| 211 | 222 |
| 212 // Whether the GPU process is valid, set to false after Send() failed. | 223 // Whether the GPU process is valid, set to false after Send() failed. |
| 213 bool valid_; | 224 bool valid_; |
| 214 | 225 |
| 215 // Whether we are running a GPU thread inside the browser process instead | 226 // Whether we are running a GPU thread inside the browser process instead |
| 216 // of a separate GPU process. | 227 // of a separate GPU process. |
| 217 bool in_process_; | 228 bool in_process_; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > | 280 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > |
| 270 SurfaceRefMap; | 281 SurfaceRefMap; |
| 271 SurfaceRefMap surface_refs_; | 282 SurfaceRefMap surface_refs_; |
| 272 | 283 |
| 273 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 284 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 274 }; | 285 }; |
| 275 | 286 |
| 276 } // namespace content | 287 } // namespace content |
| 277 | 288 |
| 278 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 289 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |