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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 void LoadedShader(const std::string& key, const std::string& data); | 156 void LoadedShader(const std::string& key, const std::string& data); |
156 | 157 |
157 private: | 158 private: |
158 static bool ValidateHost(GpuProcessHost* host); | 159 static bool ValidateHost(GpuProcessHost* host); |
159 | 160 |
160 GpuProcessHost(int host_id, GpuProcessKind kind); | 161 GpuProcessHost(int host_id, GpuProcessKind kind); |
161 ~GpuProcessHost() override; | 162 ~GpuProcessHost() override; |
162 | 163 |
163 bool Init(); | 164 bool Init(); |
164 | 165 |
| 166 // Sets up mojo support in GPU process. Returns false upon failure. |
| 167 bool SetupMojo(); |
| 168 |
165 // Post an IPC message to the UI shim's message handler on the UI thread. | 169 // Post an IPC message to the UI shim's message handler on the UI thread. |
166 void RouteOnUIThread(const IPC::Message& message); | 170 void RouteOnUIThread(const IPC::Message& message); |
167 | 171 |
168 // BrowserChildProcessHostDelegate implementation. | 172 // BrowserChildProcessHostDelegate implementation. |
169 bool OnMessageReceived(const IPC::Message& message) override; | 173 bool OnMessageReceived(const IPC::Message& message) override; |
170 void OnChannelConnected(int32 peer_pid) override; | 174 void OnChannelConnected(int32 peer_pid) override; |
171 void OnProcessLaunched() override; | 175 void OnProcessLaunched() override; |
172 void OnProcessLaunchFailed() override; | 176 void OnProcessLaunchFailed() override; |
173 void OnProcessCrashed(int exit_code) override; | 177 void OnProcessCrashed(int exit_code) override; |
| 178 ServiceRegistry* GetServiceRegistry() override; |
174 | 179 |
175 // Message handlers. | 180 // Message handlers. |
176 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 181 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
177 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 182 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
178 void OnCommandBufferCreated(CreateCommandBufferResult result); | 183 void OnCommandBufferCreated(CreateCommandBufferResult result); |
179 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); | 184 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); |
180 void OnDidCreateOffscreenContext(const GURL& url); | 185 void OnDidCreateOffscreenContext(const GURL& url); |
181 void OnDidLoseContext(bool offscreen, | 186 void OnDidLoseContext(bool offscreen, |
182 gpu::error::ContextLostReason reason, | 187 gpu::error::ContextLostReason reason, |
183 const GURL& url); | 188 const GURL& url); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 ClientIdToShaderCacheMap client_id_to_shader_cache_; | 275 ClientIdToShaderCacheMap client_id_to_shader_cache_; |
271 | 276 |
272 std::string shader_prefix_key_; | 277 std::string shader_prefix_key_; |
273 | 278 |
274 #if defined(OS_MACOSX) && !defined(OS_IOS) | 279 #if defined(OS_MACOSX) && !defined(OS_IOS) |
275 // Unique unguessable token that the GPU process is using to register | 280 // Unique unguessable token that the GPU process is using to register |
276 // IOSurfaces. | 281 // IOSurfaces. |
277 IOSurfaceManagerToken io_surface_manager_token_; | 282 IOSurfaceManagerToken io_surface_manager_token_; |
278 #endif | 283 #endif |
279 | 284 |
| 285 // Browser-side Mojo endpoint which sets up a Mojo channel with the child |
| 286 // process and contains the browser's ServiceRegistry. |
| 287 scoped_ptr<MojoApplicationHost> mojo_application_host_; |
| 288 |
280 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 289 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
281 }; | 290 }; |
282 | 291 |
283 } // namespace content | 292 } // namespace content |
284 | 293 |
285 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 294 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |