| 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_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ | 6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 public: | 35 public: |
| 36 // Takes a ref on |gpu_channel_host| and tests |context| for NULL before each | 36 // Takes a ref on |gpu_channel_host| and tests |context| for NULL before each |
| 37 // use. | 37 // use. |
| 38 RendererGpuVideoDecoderFactories( | 38 RendererGpuVideoDecoderFactories( |
| 39 GpuChannelHost* gpu_channel_host, | 39 GpuChannelHost* gpu_channel_host, |
| 40 MessageLoop* message_loop, | 40 MessageLoop* message_loop, |
| 41 WebGraphicsContext3DCommandBufferImpl* wgc3dcbi); | 41 WebGraphicsContext3DCommandBufferImpl* wgc3dcbi); |
| 42 | 42 |
| 43 virtual media::VideoDecodeAccelerator* CreateVideoDecodeAccelerator( | 43 virtual media::VideoDecodeAccelerator* CreateVideoDecodeAccelerator( |
| 44 media::VideoCodecProfile profile, | 44 media::VideoCodecProfile profile, |
| 45 const gfx::Size& frame_size, |
| 46 const std::vector<uint8_t>& extra_data, |
| 45 media::VideoDecodeAccelerator::Client* client) OVERRIDE; | 47 media::VideoDecodeAccelerator::Client* client) OVERRIDE; |
| 46 | 48 |
| 47 virtual bool CreateTextures(int32 count, const gfx::Size& size, | 49 virtual bool CreateTextures(int32 count, const gfx::Size& size, |
| 48 std::vector<uint32>* texture_ids, | 50 std::vector<uint32>* texture_ids, |
| 49 uint32* texture_target) OVERRIDE; | 51 uint32* texture_target) OVERRIDE; |
| 50 | 52 |
| 51 virtual void DeleteTexture(uint32 texture_id) OVERRIDE; | 53 virtual void DeleteTexture(uint32 texture_id) OVERRIDE; |
| 52 | 54 |
| 53 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; | 55 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; |
| 54 | 56 |
| 55 protected: | 57 protected: |
| 56 friend class base::RefCountedThreadSafe<RendererGpuVideoDecoderFactories>; | 58 friend class base::RefCountedThreadSafe<RendererGpuVideoDecoderFactories>; |
| 57 virtual ~RendererGpuVideoDecoderFactories(); | 59 virtual ~RendererGpuVideoDecoderFactories(); |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 // Helper for the constructor to acquire the ContentGLContext on the | 62 // Helper for the constructor to acquire the ContentGLContext on the |
| 61 // compositor thread (when it is enabled). | 63 // compositor thread (when it is enabled). |
| 62 void AsyncGetContext(WebGraphicsContext3DCommandBufferImpl* wgc3dcbi, | 64 void AsyncGetContext(WebGraphicsContext3DCommandBufferImpl* wgc3dcbi, |
| 63 base::WaitableEvent* waiter); | 65 base::WaitableEvent* waiter); |
| 64 | 66 |
| 65 // Async versions of the public methods. They use output parameters instead | 67 // Async versions of the public methods. They use output parameters instead |
| 66 // of return values and each takes a WaitableEvent* param to signal completion | 68 // of return values and each takes a WaitableEvent* param to signal completion |
| 67 // (except for DeleteTexture, which is fire-and-forget). | 69 // (except for DeleteTexture, which is fire-and-forget). |
| 68 // AsyncCreateSharedMemory runs on the renderer thread and the rest run on | 70 // AsyncCreateSharedMemory runs on the renderer thread and the rest run on |
| 69 // |message_loop_|. | 71 // |message_loop_|. |
| 70 void AsyncCreateVideoDecodeAccelerator( | 72 void AsyncCreateVideoDecodeAccelerator( |
| 71 media::VideoCodecProfile profile, | 73 media::VideoCodecProfile profile, |
| 74 const gfx::Size& frame_size, |
| 75 const std::vector<uint8_t>& extra_data, |
| 72 media::VideoDecodeAccelerator::Client* client, | 76 media::VideoDecodeAccelerator::Client* client, |
| 73 media::VideoDecodeAccelerator** vda, | 77 media::VideoDecodeAccelerator** vda, |
| 74 base::WaitableEvent* waiter); | 78 base::WaitableEvent* waiter); |
| 75 void AsyncCreateTextures( | 79 void AsyncCreateTextures( |
| 76 int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids, | 80 int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids, |
| 77 uint32* texture_target, bool* success, base::WaitableEvent* waiter); | 81 uint32* texture_target, bool* success, base::WaitableEvent* waiter); |
| 78 void AsyncDeleteTexture(uint32 texture_id); | 82 void AsyncDeleteTexture(uint32 texture_id); |
| 79 void AsyncCreateSharedMemory( | 83 void AsyncCreateSharedMemory( |
| 80 size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter); | 84 size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter); |
| 81 | 85 |
| 82 MessageLoop* message_loop_; | 86 MessageLoop* message_loop_; |
| 83 scoped_refptr<GpuChannelHost> gpu_channel_host_; | 87 scoped_refptr<GpuChannelHost> gpu_channel_host_; |
| 84 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context_; | 88 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context_; |
| 85 DISALLOW_IMPLICIT_CONSTRUCTORS(RendererGpuVideoDecoderFactories); | 89 DISALLOW_IMPLICIT_CONSTRUCTORS(RendererGpuVideoDecoderFactories); |
| 86 }; | 90 }; |
| 87 | 91 |
| 88 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ | 92 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ |
| OLD | NEW |