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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 namespace IPC { | 38 namespace IPC { |
39 struct ChannelHandle; | 39 struct ChannelHandle; |
40 } | 40 } |
41 | 41 |
42 namespace gpu { | 42 namespace gpu { |
43 struct GpuPreferences; | 43 struct GpuPreferences; |
44 struct SyncToken; | 44 struct SyncToken; |
45 } | 45 } |
46 | 46 |
| 47 namespace shell { |
| 48 class InterfaceProvider; |
| 49 } |
| 50 |
47 namespace content { | 51 namespace content { |
48 class BrowserChildProcessHostImpl; | 52 class BrowserChildProcessHostImpl; |
49 class GpuMainThread; | 53 class GpuMainThread; |
50 class InProcessChildThreadParams; | 54 class InProcessChildThreadParams; |
51 class MojoChildConnection; | |
52 class RenderWidgetHostViewFrameSubscriber; | 55 class RenderWidgetHostViewFrameSubscriber; |
53 class ShaderDiskCache; | 56 class ShaderDiskCache; |
54 | 57 |
55 typedef base::Thread* (*GpuMainThreadFactoryFunction)( | 58 typedef base::Thread* (*GpuMainThreadFactoryFunction)( |
56 const InProcessChildThreadParams&, const gpu::GpuPreferences&); | 59 const InProcessChildThreadParams&, const gpu::GpuPreferences&); |
57 | 60 |
58 class GpuProcessHost : public BrowserChildProcessHostDelegate, | 61 class GpuProcessHost : public BrowserChildProcessHostDelegate, |
59 public IPC::Sender, | 62 public IPC::Sender, |
60 public base::NonThreadSafe { | 63 public base::NonThreadSafe { |
61 public: | 64 public: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // 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 |
101 // 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 |
102 // it cannot be sent. | 105 // it cannot be sent. |
103 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, | 106 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, |
104 bool force_create, | 107 bool force_create, |
105 IPC::Message* message); | 108 IPC::Message* message); |
106 | 109 |
107 CONTENT_EXPORT static void RegisterGpuMainThreadFactory( | 110 CONTENT_EXPORT static void RegisterGpuMainThreadFactory( |
108 GpuMainThreadFactoryFunction create); | 111 GpuMainThreadFactoryFunction create); |
109 | 112 |
110 // BrowserChildProcessHostDelegate implementation. | 113 shell::InterfaceProvider* GetRemoteInterfaces(); |
111 shell::InterfaceProvider* GetRemoteInterfaces() override; | |
112 | 114 |
113 // Get the GPU process host for the GPU process with the given ID. Returns | 115 // Get the GPU process host for the GPU process with the given ID. Returns |
114 // null if the process no longer exists. | 116 // null if the process no longer exists. |
115 static GpuProcessHost* FromID(int host_id); | 117 static GpuProcessHost* FromID(int host_id); |
116 int host_id() const { return host_id_; } | 118 int host_id() const { return host_id_; } |
117 | 119 |
118 // IPC::Sender implementation. | 120 // IPC::Sender implementation. |
119 bool Send(IPC::Message* msg) override; | 121 bool Send(IPC::Message* msg) override; |
120 | 122 |
121 // Adds a message filter to the GpuProcessHost's channel. | 123 // Adds a message filter to the GpuProcessHost's channel. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 gpu::SurfaceHandle parent_handle, | 204 gpu::SurfaceHandle parent_handle, |
203 gpu::SurfaceHandle window_handle); | 205 gpu::SurfaceHandle window_handle); |
204 #endif | 206 #endif |
205 | 207 |
206 void CreateChannelCache(int32_t client_id); | 208 void CreateChannelCache(int32_t client_id); |
207 void OnDestroyChannel(int32_t client_id); | 209 void OnDestroyChannel(int32_t client_id); |
208 void OnCacheShader(int32_t client_id, | 210 void OnCacheShader(int32_t client_id, |
209 const std::string& key, | 211 const std::string& key, |
210 const std::string& shader); | 212 const std::string& shader); |
211 | 213 |
212 bool LaunchGpuProcess(const std::string& channel_id, | 214 bool LaunchGpuProcess(gpu::GpuPreferences* gpu_preferences); |
213 gpu::GpuPreferences* gpu_preferences); | |
214 | 215 |
215 void SendOutstandingReplies(); | 216 void SendOutstandingReplies(); |
216 | 217 |
217 void BlockLiveOffscreenContexts(); | 218 void BlockLiveOffscreenContexts(); |
218 | 219 |
219 // Update GPU crash counters. Disable GPU if crash limit is reached. | 220 // Update GPU crash counters. Disable GPU if crash limit is reached. |
220 void RecordProcessCrash(); | 221 void RecordProcessCrash(); |
221 | 222 |
222 std::string GetShaderPrefixKey(); | 223 std::string GetShaderPrefixKey(); |
223 | 224 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // Statics kept around to send to UMA histograms on GPU process lost. | 287 // Statics kept around to send to UMA histograms on GPU process lost. |
287 bool uma_memory_stats_received_; | 288 bool uma_memory_stats_received_; |
288 gpu::GPUMemoryUmaStats uma_memory_stats_; | 289 gpu::GPUMemoryUmaStats uma_memory_stats_; |
289 | 290 |
290 typedef std::map<int32_t, scoped_refptr<ShaderDiskCache>> | 291 typedef std::map<int32_t, scoped_refptr<ShaderDiskCache>> |
291 ClientIdToShaderCacheMap; | 292 ClientIdToShaderCacheMap; |
292 ClientIdToShaderCacheMap client_id_to_shader_cache_; | 293 ClientIdToShaderCacheMap client_id_to_shader_cache_; |
293 | 294 |
294 std::string shader_prefix_key_; | 295 std::string shader_prefix_key_; |
295 | 296 |
296 // Browser-side Mojo endpoint which sets up a Mojo channel with the child | |
297 // process and contains the browser's InterfaceRegistry. | |
298 const std::string child_token_; | |
299 std::unique_ptr<MojoChildConnection> mojo_child_connection_; | |
300 | |
301 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 297 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
302 }; | 298 }; |
303 | 299 |
304 } // namespace content | 300 } // namespace content |
305 | 301 |
306 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 302 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |