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

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

Issue 27420004: Remove threading from RendererGpuVideoAcceleratorFactories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dthread
Patch Set: 51676bf4 Initial. Created 7 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
Ami GONE FROM CHROMIUM 2013/10/17 22:22:17 I fail to understand the "proof" in the CL descrip
sheu 2013/10/21 05:17:35 Heh, sure.
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"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
(...skipping 15 matching lines...) Expand all
27 class GpuChannelHost; 27 class GpuChannelHost;
28 class WebGraphicsContext3DCommandBufferImpl; 28 class WebGraphicsContext3DCommandBufferImpl;
29 29
30 // Glue code to expose functionality needed by media::GpuVideoAccelerator to 30 // Glue code to expose functionality needed by media::GpuVideoAccelerator to
31 // RenderViewImpl. This class is entirely an implementation detail of 31 // RenderViewImpl. This class is entirely an implementation detail of
32 // RenderViewImpl and only has its own header to allow extraction of its 32 // RenderViewImpl and only has its own header to allow extraction of its
33 // implementation from render_view_impl.cc which is already far too large. 33 // implementation from render_view_impl.cc which is already far too large.
34 // 34 //
35 // The public methods of the class can be called from any thread, and are 35 // The public methods of the class can be called from any thread, and are
36 // internally trampolined to the appropriate thread. GPU/GL-related calls go to 36 // internally trampolined to the appropriate thread. GPU/GL-related calls go to
37 // the constructor-argument loop (the media thread). 37 // the constructor-argument loop (the media thread).
Ami GONE FROM CHROMIUM 2013/10/17 22:22:17 Paragraph is a lie.
sheu 2013/10/21 05:17:35 It is now. FWIW: this CL is based off the previou
38 class CONTENT_EXPORT RendererGpuVideoAcceleratorFactories 38 class CONTENT_EXPORT RendererGpuVideoAcceleratorFactories
39 : public media::GpuVideoAcceleratorFactories { 39 : public media::GpuVideoAcceleratorFactories {
40 public: 40 public:
41 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each 41 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each
42 // use. 42 // use.
43 RendererGpuVideoAcceleratorFactories( 43 RendererGpuVideoAcceleratorFactories(
44 GpuChannelHost* gpu_channel_host, 44 GpuChannelHost* gpu_channel_host,
45 const scoped_refptr<base::MessageLoopProxy>& message_loop, 45 const scoped_refptr<base::MessageLoopProxy>& message_loop,
46 const scoped_refptr<ContextProviderCommandBuffer>& context_provider); 46 const scoped_refptr<ContextProviderCommandBuffer>& context_provider);
47 47
(...skipping 12 matching lines...) Expand all
60 std::vector<uint32>* texture_ids, 60 std::vector<uint32>* texture_ids,
61 std::vector<gpu::Mailbox>* texture_mailboxes, 61 std::vector<gpu::Mailbox>* texture_mailboxes,
62 uint32 texture_target) OVERRIDE; 62 uint32 texture_target) OVERRIDE;
63 virtual void DeleteTexture(uint32 texture_id) OVERRIDE; 63 virtual void DeleteTexture(uint32 texture_id) OVERRIDE;
64 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE; 64 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE;
65 virtual void ReadPixels(uint32 texture_id, 65 virtual void ReadPixels(uint32 texture_id,
66 const gfx::Size& size, 66 const gfx::Size& size,
67 const SkBitmap& pixels) OVERRIDE; 67 const SkBitmap& pixels) OVERRIDE;
68 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; 68 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE;
69 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE; 69 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE;
70 virtual void Abort() OVERRIDE;
71 virtual bool IsAborted() OVERRIDE;
72 scoped_refptr<RendererGpuVideoAcceleratorFactories> Clone();
73 70
74 protected: 71 protected:
75 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>; 72 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>;
76 virtual ~RendererGpuVideoAcceleratorFactories(); 73 virtual ~RendererGpuVideoAcceleratorFactories();
77 74
78 private: 75 private:
79 RendererGpuVideoAcceleratorFactories();
80
81 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl, 76 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl,
82 // if it has not been lost yet. 77 // if it has not been lost yet.
83 WebGraphicsContext3DCommandBufferImpl* GetContext3d(); 78 WebGraphicsContext3DCommandBufferImpl* GetContext3d();
84 79
85 // Helper for the constructor to acquire the ContentGLContext on 80 // Helper for the constructor to acquire the ContentGLContext on
86 // |message_loop_|. 81 // |message_loop_|.
87 void AsyncBindContext(); 82 void AsyncBindContext();
88 83
89 // Async versions of the public methods, run on |message_loop_|. 84 // Async versions of ReadPixels, run on |message_loop_|. It uses output
90 // They use output parameters instead of return values and each takes 85 // parameters instead of return values and takes a base::WaitableEvent* param
91 // a WaitableEvent* param to signal completion (except for DeleteTexture, 86 // to signal completion.
92 // which is fire-and-forget). 87 void AsyncReadPixels(uint32 texture_id,
93 // AsyncCreateVideoDecodeAccelerator returns its output in the |vda_| member. 88 const gfx::Size& size,
94 void AsyncCreateVideoDecodeAccelerator( 89 const SkBitmap& pixels,
95 media::VideoCodecProfile profile, 90 base::WaitableEvent* waiter);
96 media::VideoDecodeAccelerator::Client* client);
97 void AsyncReadPixels(uint32 texture_id, const gfx::Size& size);
98 void AsyncDestroyVideoDecodeAccelerator();
99 91
100 scoped_refptr<base::MessageLoopProxy> message_loop_; 92 scoped_refptr<base::MessageLoopProxy> message_loop_;
101 scoped_refptr<GpuChannelHost> gpu_channel_host_; 93 scoped_refptr<GpuChannelHost> gpu_channel_host_;
102 scoped_refptr<ContextProviderCommandBuffer> context_provider_; 94 scoped_refptr<ContextProviderCommandBuffer> context_provider_;
103 95
104 // For sending requests to allocate shared memory in the Browser process. 96 // For sending requests to allocate shared memory in the Browser process.
105 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 97 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
106 98
107 // This event is signaled if we have been asked to Abort().
108 base::WaitableEvent aborted_waiter_;
109
110 // This event is signaled by asynchronous tasks posted to |message_loop_| to
111 // indicate their completion.
112 // e.g. AsyncCreateVideoDecodeAccelerator()/AsyncCreateTextures() etc.
113 base::WaitableEvent message_loop_async_waiter_;
114
115 // The vda returned by the CreateVideoDecodeAccelerator function.
116 scoped_ptr<media::VideoDecodeAccelerator> vda_;
117
118 // Bitmap returned by ReadPixels().
119 SkBitmap read_pixels_bitmap_;
120
121 // Textures returned by the CreateTexture() function. 99 // Textures returned by the CreateTexture() function.
122 std::vector<uint32> created_textures_; 100 std::vector<uint32> created_textures_;
123 std::vector<gpu::Mailbox> created_texture_mailboxes_; 101 std::vector<gpu::Mailbox> created_texture_mailboxes_;
Ami GONE FROM CHROMIUM 2013/10/17 22:22:17 Garbage
sheu 2013/10/21 05:17:35 Removed with rebase.
124 102
125 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); 103 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories);
126 }; 104 };
127 105
128 } // namespace content 106 } // namespace content
129 107
130 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ 108 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698