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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class ShaderDiskCache; | 49 class ShaderDiskCache; |
50 struct SyncToken; | 50 struct SyncToken; |
51 } | 51 } |
52 | 52 |
53 namespace service_manager { | 53 namespace service_manager { |
54 class InterfaceProvider; | 54 class InterfaceProvider; |
55 } | 55 } |
56 | 56 |
57 namespace content { | 57 namespace content { |
58 class BrowserChildProcessHostImpl; | 58 class BrowserChildProcessHostImpl; |
59 class InProcessChildThreadParams; | |
60 | |
61 typedef base::Thread* (*GpuMainThreadFactoryFunction)( | |
62 const InProcessChildThreadParams&, const gpu::GpuPreferences&); | |
63 | 59 |
64 class GpuProcessHost : public BrowserChildProcessHostDelegate, | 60 class GpuProcessHost : public BrowserChildProcessHostDelegate, |
65 public IPC::Sender, | 61 public IPC::Sender, |
66 public ui::mojom::GpuHost, | 62 public ui::mojom::GpuHost, |
67 public base::NonThreadSafe { | 63 public base::NonThreadSafe { |
68 public: | 64 public: |
69 enum GpuProcessKind { | 65 enum GpuProcessKind { |
70 GPU_PROCESS_KIND_UNSANDBOXED, | 66 GPU_PROCESS_KIND_UNSANDBOXED, |
71 GPU_PROCESS_KIND_SANDBOXED, | 67 GPU_PROCESS_KIND_SANDBOXED, |
72 GPU_PROCESS_KIND_COUNT | 68 GPU_PROCESS_KIND_COUNT |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 100 |
105 // Helper function to send the given message to the GPU process on the IO | 101 // Helper function to send the given message to the GPU process on the IO |
106 // thread. Calls Get and if a host is returned, sends it. |force_create| can | 102 // thread. Calls Get and if a host is returned, sends it. |force_create| can |
107 // be set to force the creation of GpuProcessHost if one doesn't already | 103 // be set to force the creation of GpuProcessHost if one doesn't already |
108 // exist. This function can be called from any thread. Deletes the message if | 104 // exist. This function can be called from any thread. Deletes the message if |
109 // it cannot be sent. | 105 // it cannot be sent. |
110 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, | 106 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, |
111 bool force_create, | 107 bool force_create, |
112 IPC::Message* message); | 108 IPC::Message* message); |
113 | 109 |
114 CONTENT_EXPORT static void RegisterGpuMainThreadFactory( | |
115 GpuMainThreadFactoryFunction create); | |
116 | |
117 service_manager::InterfaceProvider* GetRemoteInterfaces(); | 110 service_manager::InterfaceProvider* GetRemoteInterfaces(); |
118 | 111 |
119 // Get the GPU process host for the GPU process with the given ID. Returns | 112 // Get the GPU process host for the GPU process with the given ID. Returns |
120 // null if the process no longer exists. | 113 // null if the process no longer exists. |
121 static GpuProcessHost* FromID(int host_id); | 114 static GpuProcessHost* FromID(int host_id); |
122 int host_id() const { return host_id_; } | 115 int host_id() const { return host_id_; } |
123 | 116 |
124 // IPC::Sender implementation. | 117 // IPC::Sender implementation. |
125 bool Send(IPC::Message* msg) override; | 118 bool Send(IPC::Message* msg) override; |
126 | 119 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 ui::mojom::GpuMainAssociatedPtr gpu_main_ptr_; | 288 ui::mojom::GpuMainAssociatedPtr gpu_main_ptr_; |
296 ui::mojom::GpuServicePtr gpu_service_ptr_; | 289 ui::mojom::GpuServicePtr gpu_service_ptr_; |
297 mojo::Binding<ui::mojom::GpuHost> gpu_host_binding_; | 290 mojo::Binding<ui::mojom::GpuHost> gpu_host_binding_; |
298 | 291 |
299 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 292 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
300 }; | 293 }; |
301 | 294 |
302 } // namespace content | 295 } // namespace content |
303 | 296 |
304 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 297 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |