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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Helper function to send the given message to the GPU process on the IO | 94 // Helper function to send the given message to the GPU process on the IO |
95 // thread. Calls Get and if a host is returned, sends it. |force_create| can | 95 // thread. Calls Get and if a host is returned, sends it. |force_create| can |
96 // be set to force the creation of GpuProcessHost if one doesn't already | 96 // be set to force the creation of GpuProcessHost if one doesn't already |
97 // exist. This function can be called from any thread. Deletes the message if | 97 // exist. This function can be called from any thread. Deletes the message if |
98 // it cannot be sent. | 98 // it cannot be sent. |
99 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, | 99 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, |
100 bool force_create, | 100 bool force_create, |
101 IPC::Message* message); | 101 IPC::Message* message); |
102 | 102 |
103 // Helper function to run a callback on the IO thread. The callback receives | 103 // Helper function to run a callback on the IO thread. The callback receives |
104 // the appropriate GpuProcessHost instance. If |force_create| is false, and no | 104 // the appropriate GpuProcessHost instance. Note that the callback can be |
105 // GpuProcessHost instance exists, then the callback is never called. | 105 // called with a null host (e.g. when |force_create| is false, and no |
| 106 // GpuProcessHost instance exists). |
106 CONTENT_EXPORT static void CallOnIO( | 107 CONTENT_EXPORT static void CallOnIO( |
107 GpuProcessKind kind, | 108 GpuProcessKind kind, |
108 bool force_create, | 109 bool force_create, |
109 const base::Callback<void(GpuProcessHost*)>& callback); | 110 const base::Callback<void(GpuProcessHost*)>& callback); |
110 | 111 |
111 service_manager::InterfaceProvider* GetRemoteInterfaces(); | 112 service_manager::InterfaceProvider* GetRemoteInterfaces(); |
112 | 113 |
113 // Get the GPU process host for the GPU process with the given ID. Returns | 114 // Get the GPU process host for the GPU process with the given ID. Returns |
114 // null if the process no longer exists. | 115 // null if the process no longer exists. |
115 static GpuProcessHost* FromID(int host_id); | 116 static GpuProcessHost* FromID(int host_id); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // can stop using it. | 151 // can stop using it. |
151 void SendDestroyingVideoSurface(int surface_id, const base::Closure& done_cb); | 152 void SendDestroyingVideoSurface(int surface_id, const base::Closure& done_cb); |
152 #endif | 153 #endif |
153 | 154 |
154 // What kind of GPU process, e.g. sandboxed or unsandboxed. | 155 // What kind of GPU process, e.g. sandboxed or unsandboxed. |
155 GpuProcessKind kind(); | 156 GpuProcessKind kind(); |
156 | 157 |
157 // Forcefully terminates the GPU process. | 158 // Forcefully terminates the GPU process. |
158 void ForceShutdown(); | 159 void ForceShutdown(); |
159 | 160 |
160 // Asks the GPU process to stop by itself. | |
161 void StopGpuProcess(); | |
162 | |
163 void LoadedShader(const std::string& key, const std::string& data); | 161 void LoadedShader(const std::string& key, const std::string& data); |
164 | 162 |
165 ui::mojom::GpuService* gpu_service() { return gpu_service_ptr_.get(); } | 163 ui::mojom::GpuService* gpu_service() { return gpu_service_ptr_.get(); } |
166 | 164 |
167 private: | 165 private: |
168 class ConnectionFilterImpl; | 166 class ConnectionFilterImpl; |
169 | 167 |
170 static bool ValidateHost(GpuProcessHost* host); | 168 static bool ValidateHost(GpuProcessHost* host); |
171 | 169 |
172 GpuProcessHost(int host_id, GpuProcessKind kind); | 170 GpuProcessHost(int host_id, GpuProcessKind kind); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 mojo::Binding<ui::mojom::GpuHost> gpu_host_binding_; | 296 mojo::Binding<ui::mojom::GpuHost> gpu_host_binding_; |
299 | 297 |
300 base::WeakPtrFactory<GpuProcessHost> weak_ptr_factory_; | 298 base::WeakPtrFactory<GpuProcessHost> weak_ptr_factory_; |
301 | 299 |
302 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 300 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
303 }; | 301 }; |
304 | 302 |
305 } // namespace content | 303 } // namespace content |
306 | 304 |
307 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 305 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |