| 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 <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "content/browser/gpu/gpu_surface_tracker.h" | 18 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/common/gpu/gpu_memory_uma_stats.h" | 20 #include "content/common/gpu/gpu_memory_uma_stats.h" |
| 21 #include "content/common/gpu/gpu_process_launch_causes.h" | 21 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 22 #include "content/common/gpu/gpu_result_codes.h" |
| 22 #include "content/public/browser/browser_child_process_host_delegate.h" | 23 #include "content/public/browser/browser_child_process_host_delegate.h" |
| 23 #include "content/public/browser/gpu_data_manager.h" | 24 #include "content/public/browser/gpu_data_manager.h" |
| 24 #include "gpu/command_buffer/common/constants.h" | 25 #include "gpu/command_buffer/common/constants.h" |
| 25 #include "gpu/config/gpu_info.h" | 26 #include "gpu/config/gpu_info.h" |
| 26 #include "ipc/ipc_sender.h" | 27 #include "ipc/ipc_sender.h" |
| 27 #include "ipc/message_filter.h" | 28 #include "ipc/message_filter.h" |
| 28 #include "ui/gfx/native_widget_types.h" | 29 #include "ui/gfx/native_widget_types.h" |
| 29 #include "ui/gfx/size.h" | 30 #include "ui/gfx/size.h" |
| 30 #include "url/gurl.h" | 31 #include "url/gurl.h" |
| 31 | 32 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 56 public: | 57 public: |
| 57 enum GpuProcessKind { | 58 enum GpuProcessKind { |
| 58 GPU_PROCESS_KIND_UNSANDBOXED, | 59 GPU_PROCESS_KIND_UNSANDBOXED, |
| 59 GPU_PROCESS_KIND_SANDBOXED, | 60 GPU_PROCESS_KIND_SANDBOXED, |
| 60 GPU_PROCESS_KIND_COUNT | 61 GPU_PROCESS_KIND_COUNT |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> | 64 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> |
| 64 EstablishChannelCallback; | 65 EstablishChannelCallback; |
| 65 | 66 |
| 66 typedef base::Callback<void(bool)> CreateCommandBufferCallback; | 67 typedef base::Callback<void(CreateCommandBufferResult)> |
| 68 CreateCommandBufferCallback; |
| 67 | 69 |
| 68 typedef base::Callback<void(const gfx::Size)> CreateImageCallback; | 70 typedef base::Callback<void(const gfx::Size)> CreateImageCallback; |
| 69 | 71 |
| 70 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> | 72 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> |
| 71 CreateGpuMemoryBufferCallback; | 73 CreateGpuMemoryBufferCallback; |
| 72 | 74 |
| 73 static bool gpu_enabled() { return gpu_enabled_; } | 75 static bool gpu_enabled() { return gpu_enabled_; } |
| 74 | 76 |
| 75 // Creates a new GpuProcessHost or gets an existing one, resulting in the | 77 // Creates a new GpuProcessHost or gets an existing one, resulting in the |
| 76 // launching of a GPU process if required. Returns null on failure. It | 78 // launching of a GPU process if required. Returns null on failure. It |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 166 |
| 165 // BrowserChildProcessHostDelegate implementation. | 167 // BrowserChildProcessHostDelegate implementation. |
| 166 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 168 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 167 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 169 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
| 168 virtual void OnProcessLaunched() OVERRIDE; | 170 virtual void OnProcessLaunched() OVERRIDE; |
| 169 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 171 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
| 170 | 172 |
| 171 // Message handlers. | 173 // Message handlers. |
| 172 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 174 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
| 173 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 175 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
| 174 void OnCommandBufferCreated(bool succeeded); | 176 void OnCommandBufferCreated(CreateCommandBufferResult result); |
| 175 void OnDestroyCommandBuffer(int32 surface_id); | 177 void OnDestroyCommandBuffer(int32 surface_id); |
| 176 void OnImageCreated(const gfx::Size size); | 178 void OnImageCreated(const gfx::Size size); |
| 177 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); | 179 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); |
| 178 void OnDidCreateOffscreenContext(const GURL& url); | 180 void OnDidCreateOffscreenContext(const GURL& url); |
| 179 void OnDidLoseContext(bool offscreen, | 181 void OnDidLoseContext(bool offscreen, |
| 180 gpu::error::ContextLostReason reason, | 182 gpu::error::ContextLostReason reason, |
| 181 const GURL& url); | 183 const GURL& url); |
| 182 void OnDidDestroyOffscreenContext(const GURL& url); | 184 void OnDidDestroyOffscreenContext(const GURL& url); |
| 183 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); | 185 void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats); |
| 184 #if defined(OS_MACOSX) | 186 #if defined(OS_MACOSX) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > | 280 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > |
| 279 SurfaceRefMap; | 281 SurfaceRefMap; |
| 280 SurfaceRefMap surface_refs_; | 282 SurfaceRefMap surface_refs_; |
| 281 | 283 |
| 282 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 284 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 283 }; | 285 }; |
| 284 | 286 |
| 285 } // namespace content | 287 } // namespace content |
| 286 | 288 |
| 287 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 289 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |