Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: content/renderer/media/renderer_gpu_video_decoder_factories.h

Issue 10832264: Fix lifecycle-vs-threads of GpuVDAContext3D. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 14 matching lines...) Expand all
25 // implementation from render_view_impl.cc which is already far too large. 25 // implementation from render_view_impl.cc which is already far too large.
26 // 26 //
27 // The public methods of the class can be called from any thread, and are 27 // The public methods of the class can be called from any thread, and are
28 // internally trampolined to the appropriate thread. GPU/GL-related calls go to 28 // internally trampolined to the appropriate thread. GPU/GL-related calls go to
29 // the constructor-argument loop (mostly that's the compositor thread, or the 29 // the constructor-argument loop (mostly that's the compositor thread, or the
30 // renderer thread if threaded compositing is disabled), and shmem-related calls 30 // renderer thread if threaded compositing is disabled), and shmem-related calls
31 // go to the render thread. 31 // go to the render thread.
32 class CONTENT_EXPORT RendererGpuVideoDecoderFactories 32 class CONTENT_EXPORT RendererGpuVideoDecoderFactories
33 : public media::GpuVideoDecoder::Factories { 33 : public media::GpuVideoDecoder::Factories {
34 public: 34 public:
35 // Takes a ref on |gpu_channel_host| and tests |context| for NULL before each 35 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each
36 // use. 36 // use.
37 RendererGpuVideoDecoderFactories( 37 RendererGpuVideoDecoderFactories(
38 GpuChannelHost* gpu_channel_host, 38 GpuChannelHost* gpu_channel_host,
39 MessageLoop* message_loop, 39 MessageLoop* message_loop,
40 const base::WeakPtr<WebGraphicsContext3DCommandBufferImpl>& wgc3dcbi); 40 WebGraphicsContext3DCommandBufferImpl* wgc3dcbi);
41 41
42 virtual media::VideoDecodeAccelerator* CreateVideoDecodeAccelerator( 42 virtual media::VideoDecodeAccelerator* CreateVideoDecodeAccelerator(
43 media::VideoCodecProfile profile, 43 media::VideoCodecProfile profile,
44 media::VideoDecodeAccelerator::Client* client) OVERRIDE; 44 media::VideoDecodeAccelerator::Client* client) OVERRIDE;
45 45
46 virtual bool CreateTextures(int32 count, const gfx::Size& size, 46 virtual bool CreateTextures(int32 count, const gfx::Size& size,
47 std::vector<uint32>* texture_ids, 47 std::vector<uint32>* texture_ids,
48 uint32 texture_target) OVERRIDE; 48 uint32 texture_target) OVERRIDE;
49 49
50 virtual void DeleteTexture(uint32 texture_id) OVERRIDE; 50 virtual void DeleteTexture(uint32 texture_id) OVERRIDE;
51 51
52 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; 52 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE;
53 53
54 protected: 54 protected:
55 friend class base::RefCountedThreadSafe<RendererGpuVideoDecoderFactories>; 55 friend class base::RefCountedThreadSafe<RendererGpuVideoDecoderFactories>;
56 virtual ~RendererGpuVideoDecoderFactories(); 56 virtual ~RendererGpuVideoDecoderFactories();
57 57
58 private: 58 private:
59 // Helper for the constructor to acquire the ContentGLContext on the 59 // Helper for the constructor to acquire the ContentGLContext on the
60 // compositor thread (when it is enabled). 60 // compositor thread (when it is enabled).
61 void AsyncGetContext(base::WaitableEvent* waiter); 61 void AsyncGetContext(WebGraphicsContext3DCommandBufferImpl* context,
62 base::WaitableEvent* waiter);
62 63
63 // Async versions of the public methods. They use output parameters instead 64 // Async versions of the public methods. They use output parameters instead
64 // of return values and each takes a WaitableEvent* param to signal completion 65 // of return values and each takes a WaitableEvent* param to signal completion
65 // (except for DeleteTexture, which is fire-and-forget). 66 // (except for DeleteTexture, which is fire-and-forget).
66 // AsyncCreateSharedMemory runs on the renderer thread and the rest run on 67 // AsyncCreateSharedMemory runs on the renderer thread and the rest run on
67 // |message_loop_|. 68 // |message_loop_|.
68 void AsyncCreateVideoDecodeAccelerator( 69 void AsyncCreateVideoDecodeAccelerator(
69 media::VideoCodecProfile profile, 70 media::VideoCodecProfile profile,
70 media::VideoDecodeAccelerator::Client* client, 71 media::VideoDecodeAccelerator::Client* client,
71 media::VideoDecodeAccelerator** vda, 72 media::VideoDecodeAccelerator** vda,
72 base::WaitableEvent* waiter); 73 base::WaitableEvent* waiter);
73 void AsyncCreateTextures( 74 void AsyncCreateTextures(
74 int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids, 75 int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids,
75 uint32 texture_target, bool* success, base::WaitableEvent* waiter); 76 uint32 texture_target, bool* success, base::WaitableEvent* waiter);
76 void AsyncDeleteTexture(uint32 texture_id); 77 void AsyncDeleteTexture(uint32 texture_id);
77 void AsyncCreateSharedMemory( 78 void AsyncCreateSharedMemory(
78 size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter); 79 size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter);
79 80
80 MessageLoop* message_loop_; 81 MessageLoop* message_loop_;
81 scoped_refptr<GpuChannelHost> gpu_channel_host_; 82 scoped_refptr<GpuChannelHost> gpu_channel_host_;
82 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context_; 83 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context_;
83 DISALLOW_IMPLICIT_CONSTRUCTORS(RendererGpuVideoDecoderFactories); 84 DISALLOW_IMPLICIT_CONSTRUCTORS(RendererGpuVideoDecoderFactories);
84 }; 85 };
85 86
86 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_ 87 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698