| 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_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ |
| 6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ | 6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; | 35 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; |
| 36 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( | 36 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( |
| 37 size_t size) override; | 37 size_t size) override; |
| 38 | 38 |
| 39 int GpuProcessHostId() { return gpu_host_id_; } | 39 int GpuProcessHostId() { return gpu_host_id_; } |
| 40 #if !defined(OS_ANDROID) | 40 #if !defined(OS_ANDROID) |
| 41 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync( | 41 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync( |
| 42 CauseForGpuLaunch cause_for_gpu_launch); | 42 CauseForGpuLaunch cause_for_gpu_launch); |
| 43 #endif | 43 #endif |
| 44 void EstablishGpuChannel(CauseForGpuLaunch cause_for_gpu_launch, | 44 void EstablishGpuChannel(CauseForGpuLaunch cause_for_gpu_launch, |
| 45 const base::Closure& callback); | 45 const gpu::GpuChannelEstablishedCallback& callback); |
| 46 gpu::GpuChannelHost* GetGpuChannel(); | 46 gpu::GpuChannelHost* GetGpuChannel(); |
| 47 int GetGpuChannelId() { return gpu_client_id_; } | 47 int GetGpuChannelId() { return gpu_client_id_; } |
| 48 | 48 |
| 49 // Used to skip GpuChannelHost tests when there can be no GPU process. | 49 // Used to skip GpuChannelHost tests when there can be no GPU process. |
| 50 static bool CanUseForTesting(); | 50 static bool CanUseForTesting(); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 struct CreateRequest; | 53 struct CreateRequest; |
| 54 class EstablishRequest; | 54 class EstablishRequest; |
| 55 | 55 |
| 56 BrowserGpuChannelHostFactory(); | 56 BrowserGpuChannelHostFactory(); |
| 57 ~BrowserGpuChannelHostFactory() override; | 57 ~BrowserGpuChannelHostFactory() override; |
| 58 | 58 |
| 59 void GpuChannelEstablished(); | 59 void GpuChannelEstablished(); |
| 60 | 60 |
| 61 static void AddFilterOnIO(int gpu_host_id, | 61 static void AddFilterOnIO(int gpu_host_id, |
| 62 scoped_refptr<IPC::MessageFilter> filter); | 62 scoped_refptr<IPC::MessageFilter> filter); |
| 63 static void InitializeShaderDiskCacheOnIO(int gpu_client_id, | 63 static void InitializeShaderDiskCacheOnIO(int gpu_client_id, |
| 64 const base::FilePath& cache_dir); | 64 const base::FilePath& cache_dir); |
| 65 | 65 |
| 66 const int gpu_client_id_; | 66 const int gpu_client_id_; |
| 67 const uint64_t gpu_client_tracing_id_; | 67 const uint64_t gpu_client_tracing_id_; |
| 68 std::unique_ptr<base::WaitableEvent> shutdown_event_; | 68 std::unique_ptr<base::WaitableEvent> shutdown_event_; |
| 69 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; | 69 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; |
| 70 std::unique_ptr<BrowserGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 70 std::unique_ptr<BrowserGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 71 int gpu_host_id_; | 71 int gpu_host_id_; |
| 72 scoped_refptr<EstablishRequest> pending_request_; | 72 scoped_refptr<EstablishRequest> pending_request_; |
| 73 std::vector<base::Closure> established_callbacks_; | 73 std::vector<gpu::GpuChannelEstablishedCallback> established_callbacks_; |
| 74 | 74 |
| 75 static BrowserGpuChannelHostFactory* instance_; | 75 static BrowserGpuChannelHostFactory* instance_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory); | 77 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace content | 80 } // namespace content |
| 81 | 81 |
| 82 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ | 82 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ |
| OLD | NEW |