| 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 10 matching lines...) Expand all Loading... |
| 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/surface_handle.h" | 28 #include "gpu/ipc/common/surface_handle.h" |
| 29 #include "ipc/ipc_sender.h" | 29 #include "ipc/ipc_sender.h" |
| 30 #include "ipc/message_filter.h" | 30 #include "ipc/message_filter.h" |
| 31 #include "mojo/public/cpp/bindings/binding.h" |
| 32 #include "services/ui/gpu/interfaces/gpu_host.mojom.h" |
| 31 #include "services/ui/gpu/interfaces/gpu_main.mojom.h" | 33 #include "services/ui/gpu/interfaces/gpu_main.mojom.h" |
| 34 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" |
| 32 #include "ui/gfx/geometry/size.h" | 35 #include "ui/gfx/geometry/size.h" |
| 33 #include "ui/gfx/gpu_memory_buffer.h" | 36 #include "ui/gfx/gpu_memory_buffer.h" |
| 34 #include "url/gurl.h" | 37 #include "url/gurl.h" |
| 35 | 38 |
| 36 namespace base { | 39 namespace base { |
| 37 class Thread; | 40 class Thread; |
| 38 } | 41 } |
| 39 | 42 |
| 40 namespace IPC { | 43 namespace IPC { |
| 41 struct ChannelHandle; | 44 struct ChannelHandle; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 53 | 56 |
| 54 namespace content { | 57 namespace content { |
| 55 class BrowserChildProcessHostImpl; | 58 class BrowserChildProcessHostImpl; |
| 56 class InProcessChildThreadParams; | 59 class InProcessChildThreadParams; |
| 57 | 60 |
| 58 typedef base::Thread* (*GpuMainThreadFactoryFunction)( | 61 typedef base::Thread* (*GpuMainThreadFactoryFunction)( |
| 59 const InProcessChildThreadParams&, const gpu::GpuPreferences&); | 62 const InProcessChildThreadParams&, const gpu::GpuPreferences&); |
| 60 | 63 |
| 61 class GpuProcessHost : public BrowserChildProcessHostDelegate, | 64 class GpuProcessHost : public BrowserChildProcessHostDelegate, |
| 62 public IPC::Sender, | 65 public IPC::Sender, |
| 66 public ui::mojom::GpuHost, |
| 63 public base::NonThreadSafe { | 67 public base::NonThreadSafe { |
| 64 public: | 68 public: |
| 65 enum GpuProcessKind { | 69 enum GpuProcessKind { |
| 66 GPU_PROCESS_KIND_UNSANDBOXED, | 70 GPU_PROCESS_KIND_UNSANDBOXED, |
| 67 GPU_PROCESS_KIND_SANDBOXED, | 71 GPU_PROCESS_KIND_SANDBOXED, |
| 68 GPU_PROCESS_KIND_COUNT | 72 GPU_PROCESS_KIND_COUNT |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> | 75 typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)> |
| 72 EstablishChannelCallback; | 76 EstablishChannelCallback; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // Post an IPC message to the UI shim's message handler on the UI thread. | 181 // Post an IPC message to the UI shim's message handler on the UI thread. |
| 178 void RouteOnUIThread(const IPC::Message& message); | 182 void RouteOnUIThread(const IPC::Message& message); |
| 179 | 183 |
| 180 // BrowserChildProcessHostDelegate implementation. | 184 // BrowserChildProcessHostDelegate implementation. |
| 181 bool OnMessageReceived(const IPC::Message& message) override; | 185 bool OnMessageReceived(const IPC::Message& message) override; |
| 182 void OnChannelConnected(int32_t peer_pid) override; | 186 void OnChannelConnected(int32_t peer_pid) override; |
| 183 void OnProcessLaunched() override; | 187 void OnProcessLaunched() override; |
| 184 void OnProcessLaunchFailed(int error_code) override; | 188 void OnProcessLaunchFailed(int error_code) override; |
| 185 void OnProcessCrashed(int exit_code) override; | 189 void OnProcessCrashed(int exit_code) override; |
| 186 | 190 |
| 191 // ui::mojom::GpuHost: |
| 192 void DidInitialize(const gpu::GPUInfo& gpu_info) override; |
| 193 void DidCreateOffscreenContext(const GURL& url) override; |
| 194 void DidDestroyOffscreenContext(const GURL& url) override; |
| 195 void DidDestroyChannel(int32_t client_id) override; |
| 196 void DidLoseContext(bool offscreen, |
| 197 gpu::error::ContextLostReason reason, |
| 198 const GURL& active_url) override; |
| 199 void SetChildSurface(gpu::SurfaceHandle parent, |
| 200 gpu::SurfaceHandle child) override; |
| 201 void StoreShaderToDisk(int32_t client_id, |
| 202 const std::string& key, |
| 203 const std::string& shader) override; |
| 204 |
| 187 // Message handlers. | 205 // Message handlers. |
| 188 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 206 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
| 189 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 207 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
| 190 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); | 208 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); |
| 191 #if defined(OS_ANDROID) | 209 #if defined(OS_ANDROID) |
| 192 void OnDestroyingVideoSurfaceAck(int surface_id); | 210 void OnDestroyingVideoSurfaceAck(int surface_id); |
| 193 #endif | 211 #endif |
| 194 void OnDidCreateOffscreenContext(const GURL& url); | 212 void OnDidCreateOffscreenContext(const GURL& url); |
| 195 void OnDidLoseContext(bool offscreen, | 213 void OnDidLoseContext(bool offscreen, |
| 196 gpu::error::ContextLostReason reason, | 214 gpu::error::ContextLostReason reason, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // automatic execution of 3D content from those domains. | 301 // automatic execution of 3D content from those domains. |
| 284 std::multiset<GURL> urls_with_live_offscreen_contexts_; | 302 std::multiset<GURL> urls_with_live_offscreen_contexts_; |
| 285 | 303 |
| 286 typedef std::map<int32_t, scoped_refptr<gpu::ShaderDiskCache>> | 304 typedef std::map<int32_t, scoped_refptr<gpu::ShaderDiskCache>> |
| 287 ClientIdToShaderCacheMap; | 305 ClientIdToShaderCacheMap; |
| 288 ClientIdToShaderCacheMap client_id_to_shader_cache_; | 306 ClientIdToShaderCacheMap client_id_to_shader_cache_; |
| 289 | 307 |
| 290 std::string shader_prefix_key_info_; | 308 std::string shader_prefix_key_info_; |
| 291 | 309 |
| 292 ui::mojom::GpuMainAssociatedPtr gpu_main_ptr_; | 310 ui::mojom::GpuMainAssociatedPtr gpu_main_ptr_; |
| 311 ui::mojom::GpuServicePtr gpu_service_ptr_; |
| 312 mojo::Binding<ui::mojom::GpuHost> gpu_host_binding_; |
| 293 | 313 |
| 294 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 314 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 295 }; | 315 }; |
| 296 | 316 |
| 297 } // namespace content | 317 } // namespace content |
| 298 | 318 |
| 299 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 319 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |