| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 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 |
| 104 // the appropriate GpuProcessHost instance. If |force_create| is false, and no |
| 105 // GpuProcessHost instance exists, then the callback is never called. |
| 106 static void CallOnIO(GpuProcessKind kind, |
| 107 bool force_create, |
| 108 const base::Callback<void(GpuProcessHost*)>& callback); |
| 109 |
| 103 service_manager::InterfaceProvider* GetRemoteInterfaces(); | 110 service_manager::InterfaceProvider* GetRemoteInterfaces(); |
| 104 | 111 |
| 105 // 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 |
| 106 // null if the process no longer exists. | 113 // null if the process no longer exists. |
| 107 static GpuProcessHost* FromID(int host_id); | 114 static GpuProcessHost* FromID(int host_id); |
| 108 int host_id() const { return host_id_; } | 115 int host_id() const { return host_id_; } |
| 109 | 116 |
| 110 // IPC::Sender implementation. | 117 // IPC::Sender implementation. |
| 111 bool Send(IPC::Message* msg) override; | 118 bool Send(IPC::Message* msg) override; |
| 112 | 119 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 GpuProcessKind kind(); | 154 GpuProcessKind kind(); |
| 148 | 155 |
| 149 // Forcefully terminates the GPU process. | 156 // Forcefully terminates the GPU process. |
| 150 void ForceShutdown(); | 157 void ForceShutdown(); |
| 151 | 158 |
| 152 // Asks the GPU process to stop by itself. | 159 // Asks the GPU process to stop by itself. |
| 153 void StopGpuProcess(); | 160 void StopGpuProcess(); |
| 154 | 161 |
| 155 void LoadedShader(const std::string& key, const std::string& data); | 162 void LoadedShader(const std::string& key, const std::string& data); |
| 156 | 163 |
| 164 ui::mojom::GpuService* gpu_service() { return gpu_service_ptr_.get(); } |
| 165 |
| 157 private: | 166 private: |
| 158 class ConnectionFilterImpl; | 167 class ConnectionFilterImpl; |
| 159 | 168 |
| 160 static bool ValidateHost(GpuProcessHost* host); | 169 static bool ValidateHost(GpuProcessHost* host); |
| 161 | 170 |
| 162 GpuProcessHost(int host_id, GpuProcessKind kind); | 171 GpuProcessHost(int host_id, GpuProcessKind kind); |
| 163 ~GpuProcessHost() override; | 172 ~GpuProcessHost() override; |
| 164 | 173 |
| 165 bool Init(); | 174 bool Init(); |
| 166 | 175 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 mojo::Binding<ui::mojom::GpuHost> gpu_host_binding_; | 297 mojo::Binding<ui::mojom::GpuHost> gpu_host_binding_; |
| 289 | 298 |
| 290 base::WeakPtrFactory<GpuProcessHost> weak_ptr_factory_; | 299 base::WeakPtrFactory<GpuProcessHost> weak_ptr_factory_; |
| 291 | 300 |
| 292 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 301 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 293 }; | 302 }; |
| 294 | 303 |
| 295 } // namespace content | 304 } // namespace content |
| 296 | 305 |
| 297 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 306 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |