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