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