| 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 <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/common/gpu/gpu_process_launch_causes.h" | 17 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 18 #include "content/public/browser/browser_child_process_host_delegate.h" | 18 #include "content/public/browser/browser_child_process_host_delegate.h" |
| 19 #include "content/public/browser/gpu_data_manager.h" | 19 #include "content/public/browser/gpu_data_manager.h" |
| 20 #include "content/public/common/gpu_info.h" | 20 #include "content/public/common/gpu_info.h" |
| 21 #include "gpu/command_buffer/common/constants.h" |
| 21 #include "ipc/ipc_channel_proxy.h" | 22 #include "ipc/ipc_channel_proxy.h" |
| 22 #include "ipc/ipc_sender.h" | 23 #include "ipc/ipc_sender.h" |
| 24 #include "googleurl/src/gurl.h" |
| 23 #include "ui/gfx/native_widget_types.h" | 25 #include "ui/gfx/native_widget_types.h" |
| 24 #include "ui/gfx/size.h" | 26 #include "ui/gfx/size.h" |
| 25 | 27 |
| 26 struct GPUCreateCommandBufferConfig; | 28 struct GPUCreateCommandBufferConfig; |
| 27 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 29 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 28 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; | 30 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; |
| 29 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; | 31 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; |
| 30 | 32 |
| 31 namespace IPC { | 33 namespace IPC { |
| 32 struct ChannelHandle; | 34 struct ChannelHandle; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 136 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
| 135 virtual void OnProcessLaunched() OVERRIDE; | 137 virtual void OnProcessLaunched() OVERRIDE; |
| 136 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 138 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
| 137 | 139 |
| 138 // Message handlers. | 140 // Message handlers. |
| 139 void OnInitialized(bool result); | 141 void OnInitialized(bool result); |
| 140 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 142 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
| 141 void OnCommandBufferCreated(const int32 route_id); | 143 void OnCommandBufferCreated(const int32 route_id); |
| 142 void OnDestroyCommandBuffer(int32 surface_id); | 144 void OnDestroyCommandBuffer(int32 surface_id); |
| 143 void OnImageCreated(const gfx::Size size); | 145 void OnImageCreated(const gfx::Size size); |
| 144 | 146 void OnDidCreateOffscreenContext(const GURL& containing_document_url); |
| 147 void OnDidLoseContext(bool offscreen, |
| 148 gpu::error::ContextLostReason reason, |
| 149 const GURL& containing_document_url); |
| 150 void OnDidDestroyOffscreenContext(const GURL& containing_document_url); |
| 145 #if defined(OS_MACOSX) | 151 #if defined(OS_MACOSX) |
| 146 void OnAcceleratedSurfaceBuffersSwapped( | 152 void OnAcceleratedSurfaceBuffersSwapped( |
| 147 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); | 153 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); |
| 148 #endif | 154 #endif |
| 149 // Note: Different implementations depending on USE_AURA. | 155 // Note: Different implementations depending on USE_AURA. |
| 150 #if defined(OS_WIN) | 156 #if defined(OS_WIN) |
| 151 void OnAcceleratedSurfaceBuffersSwapped( | 157 void OnAcceleratedSurfaceBuffersSwapped( |
| 152 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); | 158 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); |
| 153 void OnAcceleratedSurfacePostSubBuffer( | 159 void OnAcceleratedSurfacePostSubBuffer( |
| 154 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params); | 160 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 225 |
| 220 // Master switch for enabling/disabling GPU acceleration for the current | 226 // Master switch for enabling/disabling GPU acceleration for the current |
| 221 // browser session. It does not change the acceleration settings for | 227 // browser session. It does not change the acceleration settings for |
| 222 // existing tabs, just the future ones. | 228 // existing tabs, just the future ones. |
| 223 static bool gpu_enabled_; | 229 static bool gpu_enabled_; |
| 224 | 230 |
| 225 static bool hardware_gpu_enabled_; | 231 static bool hardware_gpu_enabled_; |
| 226 | 232 |
| 227 scoped_ptr<BrowserChildProcessHostImpl> process_; | 233 scoped_ptr<BrowserChildProcessHostImpl> process_; |
| 228 | 234 |
| 235 // Track the URLs of the pages which have live offscreen contexts, |
| 236 // assumed to be associated with untrusted content such as WebGL. |
| 237 // For best robustness, when any context lost notification is |
| 238 // received, assume all of these URLs are guilty, and block |
| 239 // automatic execution of 3D content from those domains. |
| 240 std::multiset<GURL> urls_with_live_offscreen_contexts_; |
| 241 |
| 229 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 242 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 230 }; | 243 }; |
| 231 | 244 |
| 232 } // namespace content | 245 } // namespace content |
| 233 | 246 |
| 234 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 247 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |