OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 : public media::GpuVideoAcceleratorFactories { | 38 : public media::GpuVideoAcceleratorFactories { |
39 public: | 39 public: |
40 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each | 40 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each |
41 // use. Safe to call from any thread. | 41 // use. Safe to call from any thread. |
42 static scoped_refptr<RendererGpuVideoAcceleratorFactories> Create( | 42 static scoped_refptr<RendererGpuVideoAcceleratorFactories> Create( |
43 GpuChannelHost* gpu_channel_host, | 43 GpuChannelHost* gpu_channel_host, |
44 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 44 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
45 const scoped_refptr<ContextProviderCommandBuffer>& context_provider); | 45 const scoped_refptr<ContextProviderCommandBuffer>& context_provider); |
46 | 46 |
47 // media::GpuVideoAcceleratorFactories implementation. | 47 // media::GpuVideoAcceleratorFactories implementation. |
48 virtual scoped_ptr<media::VideoDecodeAccelerator> | 48 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() |
49 CreateVideoDecodeAccelerator() override; | 49 override; |
50 virtual scoped_ptr<media::VideoEncodeAccelerator> | 50 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() |
51 CreateVideoEncodeAccelerator() override; | 51 override; |
52 // Creates textures and produces them into mailboxes. Returns true on success | 52 // Creates textures and produces them into mailboxes. Returns true on success |
53 // or false on failure. | 53 // or false on failure. |
54 virtual bool CreateTextures(int32 count, | 54 bool CreateTextures(int32 count, |
55 const gfx::Size& size, | 55 const gfx::Size& size, |
56 std::vector<uint32>* texture_ids, | 56 std::vector<uint32>* texture_ids, |
57 std::vector<gpu::Mailbox>* texture_mailboxes, | 57 std::vector<gpu::Mailbox>* texture_mailboxes, |
58 uint32 texture_target) override; | 58 uint32 texture_target) override; |
59 virtual void DeleteTexture(uint32 texture_id) override; | 59 void DeleteTexture(uint32 texture_id) override; |
60 virtual void WaitSyncPoint(uint32 sync_point) override; | 60 void WaitSyncPoint(uint32 sync_point) override; |
61 virtual void ReadPixels(uint32 texture_id, | 61 void ReadPixels(uint32 texture_id, |
62 const gfx::Rect& visible_rect, | 62 const gfx::Rect& visible_rect, |
63 const SkBitmap& pixels) override; | 63 const SkBitmap& pixels) override; |
64 virtual base::SharedMemory* CreateSharedMemory(size_t size) override; | 64 base::SharedMemory* CreateSharedMemory(size_t size) override; |
65 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; | 65 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; |
66 virtual std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 66 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
67 GetVideoEncodeAcceleratorSupportedProfiles() override; | 67 GetVideoEncodeAcceleratorSupportedProfiles() override; |
68 | 68 |
69 private: | 69 private: |
70 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>; | 70 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>; |
71 RendererGpuVideoAcceleratorFactories( | 71 RendererGpuVideoAcceleratorFactories( |
72 GpuChannelHost* gpu_channel_host, | 72 GpuChannelHost* gpu_channel_host, |
73 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 73 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
74 const scoped_refptr<ContextProviderCommandBuffer>& context_provider); | 74 const scoped_refptr<ContextProviderCommandBuffer>& context_provider); |
75 virtual ~RendererGpuVideoAcceleratorFactories(); | 75 ~RendererGpuVideoAcceleratorFactories() override; |
76 | 76 |
77 // Helper to bind |context_provider| to the |task_runner_| thread after | 77 // Helper to bind |context_provider| to the |task_runner_| thread after |
78 // construction. | 78 // construction. |
79 void BindContext(); | 79 void BindContext(); |
80 | 80 |
81 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl, | 81 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl, |
82 // if it has not been lost yet. | 82 // if it has not been lost yet. |
83 WebGraphicsContext3DCommandBufferImpl* GetContext3d(); | 83 WebGraphicsContext3DCommandBufferImpl* GetContext3d(); |
84 GLHelper* GetGLHelper(); | 84 GLHelper* GetGLHelper(); |
85 | 85 |
86 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 86 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
87 scoped_refptr<GpuChannelHost> gpu_channel_host_; | 87 scoped_refptr<GpuChannelHost> gpu_channel_host_; |
88 scoped_refptr<ContextProviderCommandBuffer> context_provider_; | 88 scoped_refptr<ContextProviderCommandBuffer> context_provider_; |
89 scoped_ptr<GLHelper> gl_helper_; | 89 scoped_ptr<GLHelper> gl_helper_; |
90 | 90 |
91 // For sending requests to allocate shared memory in the Browser process. | 91 // For sending requests to allocate shared memory in the Browser process. |
92 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 92 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); | 94 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace content | 97 } // namespace content |
98 | 98 |
99 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 99 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
OLD | NEW |