| 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 26 matching lines...) Expand all Loading... |
| 37 struct GPUCreateCommandBufferConfig; | 37 struct GPUCreateCommandBufferConfig; |
| 38 | 38 |
| 39 namespace IPC { | 39 namespace IPC { |
| 40 struct ChannelHandle; | 40 struct ChannelHandle; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace content { | 43 namespace content { |
| 44 class BrowserChildProcessHostImpl; | 44 class BrowserChildProcessHostImpl; |
| 45 class GpuMainThread; | 45 class GpuMainThread; |
| 46 class InProcessChildThreadParams; | 46 class InProcessChildThreadParams; |
| 47 class MojoApplicationHost; |
| 47 class RenderWidgetHostViewFrameSubscriber; | 48 class RenderWidgetHostViewFrameSubscriber; |
| 48 class ShaderDiskCache; | 49 class ShaderDiskCache; |
| 49 | 50 |
| 50 typedef base::Thread* (*GpuMainThreadFactoryFunction)( | 51 typedef base::Thread* (*GpuMainThreadFactoryFunction)( |
| 51 const InProcessChildThreadParams&); | 52 const InProcessChildThreadParams&); |
| 52 | 53 |
| 53 class GpuProcessHost : public BrowserChildProcessHostDelegate, | 54 class GpuProcessHost : public BrowserChildProcessHostDelegate, |
| 54 public IPC::Sender, | 55 public IPC::Sender, |
| 55 public base::NonThreadSafe { | 56 public base::NonThreadSafe { |
| 56 public: | 57 public: |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void LoadedShader(const std::string& key, const std::string& data); | 166 void LoadedShader(const std::string& key, const std::string& data); |
| 166 | 167 |
| 167 private: | 168 private: |
| 168 static bool ValidateHost(GpuProcessHost* host); | 169 static bool ValidateHost(GpuProcessHost* host); |
| 169 | 170 |
| 170 GpuProcessHost(int host_id, GpuProcessKind kind); | 171 GpuProcessHost(int host_id, GpuProcessKind kind); |
| 171 ~GpuProcessHost() override; | 172 ~GpuProcessHost() override; |
| 172 | 173 |
| 173 bool Init(); | 174 bool Init(); |
| 174 | 175 |
| 176 // Sets up mojo support in GPU process. Returns false upon failure. |
| 177 bool SetupMojo(); |
| 178 |
| 175 // Post an IPC message to the UI shim's message handler on the UI thread. | 179 // Post an IPC message to the UI shim's message handler on the UI thread. |
| 176 void RouteOnUIThread(const IPC::Message& message); | 180 void RouteOnUIThread(const IPC::Message& message); |
| 177 | 181 |
| 178 // BrowserChildProcessHostDelegate implementation. | 182 // BrowserChildProcessHostDelegate implementation. |
| 179 bool OnMessageReceived(const IPC::Message& message) override; | 183 bool OnMessageReceived(const IPC::Message& message) override; |
| 180 void OnChannelConnected(int32 peer_pid) override; | 184 void OnChannelConnected(int32 peer_pid) override; |
| 181 void OnProcessLaunched() override; | 185 void OnProcessLaunched() override; |
| 182 void OnProcessLaunchFailed() override; | 186 void OnProcessLaunchFailed() override; |
| 183 void OnProcessCrashed(int exit_code) override; | 187 void OnProcessCrashed(int exit_code) override; |
| 188 ServiceRegistry* GetServiceRegistry() override; |
| 184 | 189 |
| 185 // Message handlers. | 190 // Message handlers. |
| 186 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 191 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
| 187 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 192 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
| 188 void OnCommandBufferCreated(CreateCommandBufferResult result); | 193 void OnCommandBufferCreated(CreateCommandBufferResult result); |
| 189 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); | 194 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); |
| 190 void OnDidCreateOffscreenContext(const GURL& url); | 195 void OnDidCreateOffscreenContext(const GURL& url); |
| 191 void OnDidLoseContext(bool offscreen, | 196 void OnDidLoseContext(bool offscreen, |
| 192 gpu::error::ContextLostReason reason, | 197 gpu::error::ContextLostReason reason, |
| 193 const GURL& url); | 198 const GURL& url); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 ClientIdToShaderCacheMap client_id_to_shader_cache_; | 285 ClientIdToShaderCacheMap client_id_to_shader_cache_; |
| 281 | 286 |
| 282 std::string shader_prefix_key_; | 287 std::string shader_prefix_key_; |
| 283 | 288 |
| 284 #if defined(OS_MACOSX) && !defined(OS_IOS) | 289 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 285 // Unique unguessable token that the GPU process is using to register | 290 // Unique unguessable token that the GPU process is using to register |
| 286 // IOSurfaces. | 291 // IOSurfaces. |
| 287 IOSurfaceManagerToken io_surface_manager_token_; | 292 IOSurfaceManagerToken io_surface_manager_token_; |
| 288 #endif | 293 #endif |
| 289 | 294 |
| 295 // Browser-side Mojo endpoint which sets up a Mojo channel with the child |
| 296 // process and contains the browser's ServiceRegistry. |
| 297 scoped_ptr<MojoApplicationHost> mojo_application_host_; |
| 298 |
| 290 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 299 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 291 }; | 300 }; |
| 292 | 301 |
| 293 } // namespace content | 302 } // namespace content |
| 294 | 303 |
| 295 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 304 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |