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> |
11 #include <queue> | 11 #include <queue> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
22 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
23 #include "content/common/gpu/gpu_memory_uma_stats.h" | |
24 #include "content/common/gpu_process_launch_causes.h" | 23 #include "content/common/gpu_process_launch_causes.h" |
25 #include "content/public/browser/browser_child_process_host_delegate.h" | 24 #include "content/public/browser/browser_child_process_host_delegate.h" |
26 #include "content/public/browser/gpu_data_manager.h" | 25 #include "content/public/browser/gpu_data_manager.h" |
27 #include "gpu/command_buffer/common/constants.h" | 26 #include "gpu/command_buffer/common/constants.h" |
28 #include "gpu/config/gpu_info.h" | 27 #include "gpu/config/gpu_info.h" |
| 28 #include "gpu/ipc/common/gpu_memory_uma_stats.h" |
29 #include "gpu/ipc/common/surface_handle.h" | 29 #include "gpu/ipc/common/surface_handle.h" |
30 #include "ipc/ipc_sender.h" | 30 #include "ipc/ipc_sender.h" |
31 #include "ipc/message_filter.h" | 31 #include "ipc/message_filter.h" |
32 #include "ui/gfx/geometry/size.h" | 32 #include "ui/gfx/geometry/size.h" |
33 #include "ui/gfx/gpu_memory_buffer.h" | 33 #include "ui/gfx/gpu_memory_buffer.h" |
34 #include "url/gurl.h" | 34 #include "url/gurl.h" |
35 | 35 |
36 struct GPUCreateCommandBufferConfig; | 36 struct GPUCreateCommandBufferConfig; |
37 | 37 |
38 namespace IPC { | 38 namespace IPC { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 // Message handlers. | 186 // Message handlers. |
187 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 187 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
188 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 188 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
189 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); | 189 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); |
190 void OnDidCreateOffscreenContext(const GURL& url); | 190 void OnDidCreateOffscreenContext(const GURL& url); |
191 void OnDidLoseContext(bool offscreen, | 191 void OnDidLoseContext(bool offscreen, |
192 gpu::error::ContextLostReason reason, | 192 gpu::error::ContextLostReason reason, |
193 const GURL& url); | 193 const GURL& url); |
194 void OnDidDestroyOffscreenContext(const GURL& url); | 194 void OnDidDestroyOffscreenContext(const GURL& url); |
195 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); | 195 void OnGpuMemoryUmaStatsReceived(const gpu::GPUMemoryUmaStats& stats); |
196 #if defined(OS_MACOSX) | 196 #if defined(OS_MACOSX) |
197 void OnAcceleratedSurfaceBuffersSwapped(const IPC::Message& message); | 197 void OnAcceleratedSurfaceBuffersSwapped(const IPC::Message& message); |
198 #endif | 198 #endif |
199 | 199 |
200 #if defined(OS_WIN) | 200 #if defined(OS_WIN) |
201 void OnAcceleratedSurfaceCreatedChildWindow( | 201 void OnAcceleratedSurfaceCreatedChildWindow( |
202 gpu::SurfaceHandle parent_handle, | 202 gpu::SurfaceHandle parent_handle, |
203 gpu::SurfaceHandle window_handle); | 203 gpu::SurfaceHandle window_handle); |
204 #endif | 204 #endif |
205 | 205 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 // Track the URLs of the pages which have live offscreen contexts, | 275 // Track the URLs of the pages which have live offscreen contexts, |
276 // assumed to be associated with untrusted content such as WebGL. | 276 // assumed to be associated with untrusted content such as WebGL. |
277 // For best robustness, when any context lost notification is | 277 // For best robustness, when any context lost notification is |
278 // received, assume all of these URLs are guilty, and block | 278 // received, assume all of these URLs are guilty, and block |
279 // automatic execution of 3D content from those domains. | 279 // automatic execution of 3D content from those domains. |
280 std::multiset<GURL> urls_with_live_offscreen_contexts_; | 280 std::multiset<GURL> urls_with_live_offscreen_contexts_; |
281 | 281 |
282 // Statics kept around to send to UMA histograms on GPU process lost. | 282 // Statics kept around to send to UMA histograms on GPU process lost. |
283 bool uma_memory_stats_received_; | 283 bool uma_memory_stats_received_; |
284 GPUMemoryUmaStats uma_memory_stats_; | 284 gpu::GPUMemoryUmaStats uma_memory_stats_; |
285 | 285 |
286 typedef std::map<int32_t, scoped_refptr<ShaderDiskCache>> | 286 typedef std::map<int32_t, scoped_refptr<ShaderDiskCache>> |
287 ClientIdToShaderCacheMap; | 287 ClientIdToShaderCacheMap; |
288 ClientIdToShaderCacheMap client_id_to_shader_cache_; | 288 ClientIdToShaderCacheMap client_id_to_shader_cache_; |
289 | 289 |
290 std::string shader_prefix_key_; | 290 std::string shader_prefix_key_; |
291 | 291 |
292 // Browser-side Mojo endpoint which sets up a Mojo channel with the child | 292 // Browser-side Mojo endpoint which sets up a Mojo channel with the child |
293 // process and contains the browser's ServiceRegistry. | 293 // process and contains the browser's ServiceRegistry. |
294 scoped_ptr<MojoApplicationHost> mojo_application_host_; | 294 scoped_ptr<MojoApplicationHost> mojo_application_host_; |
295 | 295 |
296 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 296 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
297 }; | 297 }; |
298 | 298 |
299 } // namespace content | 299 } // namespace content |
300 | 300 |
301 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 301 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |