| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/common/gpu/client/gpu_channel_host.h" | 12 #include "content/common/gpu/client/gpu_channel_host.h" |
| 13 #include "content/common/gpu/client/gpu_memory_buffer_factory_host.h" | 13 #include "content/common/gpu/client/gpu_memory_buffer_factory_host.h" |
| 14 #include "ipc/message_filter.h" | 14 #include "ipc/message_filter.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class GpuMemoryBufferImpl; |
| 17 | 18 |
| 18 class CONTENT_EXPORT BrowserGpuChannelHostFactory | 19 class CONTENT_EXPORT BrowserGpuChannelHostFactory |
| 19 : public GpuChannelHostFactory, | 20 : public GpuChannelHostFactory, |
| 20 public GpuMemoryBufferFactoryHost { | 21 public GpuMemoryBufferFactoryHost { |
| 21 public: | 22 public: |
| 22 static void Initialize(bool establish_gpu_channel); | 23 static void Initialize(bool establish_gpu_channel); |
| 23 static void Terminate(); | 24 static void Terminate(); |
| 24 static BrowserGpuChannelHostFactory* instance() { return instance_; } | 25 static BrowserGpuChannelHostFactory* instance() { return instance_; } |
| 25 | 26 |
| 26 // GpuChannelHostFactory implementation. | 27 // GpuChannelHostFactory implementation. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 int32 surface_id, | 85 int32 surface_id, |
| 85 const GPUCreateCommandBufferConfig& init_params); | 86 const GPUCreateCommandBufferConfig& init_params); |
| 86 static void CommandBufferCreatedOnIO(CreateRequest* request, | 87 static void CommandBufferCreatedOnIO(CreateRequest* request, |
| 87 CreateCommandBufferResult result); | 88 CreateCommandBufferResult result); |
| 88 static void AddFilterOnIO(int gpu_host_id, | 89 static void AddFilterOnIO(int gpu_host_id, |
| 89 scoped_refptr<IPC::MessageFilter> filter); | 90 scoped_refptr<IPC::MessageFilter> filter); |
| 90 static void AllocateGpuMemoryBufferOnIO( | 91 static void AllocateGpuMemoryBufferOnIO( |
| 91 AllocateGpuMemoryBufferRequest* request); | 92 AllocateGpuMemoryBufferRequest* request); |
| 92 static void DeleteGpuMemoryBufferOnIO( | 93 static void DeleteGpuMemoryBufferOnIO( |
| 93 scoped_ptr<gfx::GpuMemoryBuffer> buffer); | 94 scoped_ptr<gfx::GpuMemoryBuffer> buffer); |
| 95 static void GpuMemoryBufferImplCreatedOnIO( |
| 96 AllocateGpuMemoryBufferRequest* request, |
| 97 scoped_ptr<GpuMemoryBufferImpl> buffer); |
| 94 void OnGpuMemoryBufferCreated(uint32 request_id, | 98 void OnGpuMemoryBufferCreated(uint32 request_id, |
| 95 const gfx::GpuMemoryBufferHandle& handle); | 99 const gfx::GpuMemoryBufferHandle& handle); |
| 96 | 100 |
| 97 const int gpu_client_id_; | 101 const int gpu_client_id_; |
| 98 scoped_ptr<base::WaitableEvent> shutdown_event_; | 102 scoped_ptr<base::WaitableEvent> shutdown_event_; |
| 99 scoped_refptr<GpuChannelHost> gpu_channel_; | 103 scoped_refptr<GpuChannelHost> gpu_channel_; |
| 100 int gpu_host_id_; | 104 int gpu_host_id_; |
| 101 scoped_refptr<EstablishRequest> pending_request_; | 105 scoped_refptr<EstablishRequest> pending_request_; |
| 102 std::vector<base::Closure> established_callbacks_; | 106 std::vector<base::Closure> established_callbacks_; |
| 103 uint32 next_create_gpu_memory_buffer_request_id_; | 107 uint32 next_create_gpu_memory_buffer_request_id_; |
| 104 typedef std::map<uint32, CreateGpuMemoryBufferCallback> | 108 typedef std::map<uint32, CreateGpuMemoryBufferCallback> |
| 105 CreateGpuMemoryBufferCallbackMap; | 109 CreateGpuMemoryBufferCallbackMap; |
| 106 CreateGpuMemoryBufferCallbackMap create_gpu_memory_buffer_requests_; | 110 CreateGpuMemoryBufferCallbackMap create_gpu_memory_buffer_requests_; |
| 107 | 111 |
| 108 static BrowserGpuChannelHostFactory* instance_; | 112 static BrowserGpuChannelHostFactory* instance_; |
| 109 | 113 |
| 110 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory); | 114 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory); |
| 111 }; | 115 }; |
| 112 | 116 |
| 113 } // namespace content | 117 } // namespace content |
| 114 | 118 |
| 115 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ | 119 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ |
| OLD | NEW |