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

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

Issue 508293003: Change media MessageLoopProxy usage to SingleThreadTaskRunners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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.
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 14 matching lines...) Expand all
25 class GpuChannelHost; 25 class GpuChannelHost;
26 class WebGraphicsContext3DCommandBufferImpl; 26 class WebGraphicsContext3DCommandBufferImpl;
27 27
28 // Glue code to expose functionality needed by media::GpuVideoAccelerator to 28 // Glue code to expose functionality needed by media::GpuVideoAccelerator to
29 // RenderViewImpl. This class is entirely an implementation detail of 29 // RenderViewImpl. This class is entirely an implementation detail of
30 // RenderViewImpl and only has its own header to allow extraction of its 30 // RenderViewImpl and only has its own header to allow extraction of its
31 // implementation from render_view_impl.cc which is already far too large. 31 // implementation from render_view_impl.cc which is already far too large.
32 // 32 //
33 // The RendererGpuVideoAcceleratorFactories can be constructed on any thread, 33 // The RendererGpuVideoAcceleratorFactories can be constructed on any thread,
34 // but subsequent calls to all public methods of the class must be called from 34 // but subsequent calls to all public methods of the class must be called from
35 // the |message_loop_proxy_|, as provided during construction. 35 // the |task_runner_|, as provided during construction.
36 class CONTENT_EXPORT RendererGpuVideoAcceleratorFactories 36 class CONTENT_EXPORT RendererGpuVideoAcceleratorFactories
37 : public media::GpuVideoAcceleratorFactories { 37 : public media::GpuVideoAcceleratorFactories {
38 public: 38 public:
39 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each 39 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each
40 // use. Safe to call from any thread. 40 // use. Safe to call from any thread.
41 static scoped_refptr<RendererGpuVideoAcceleratorFactories> Create( 41 static scoped_refptr<RendererGpuVideoAcceleratorFactories> Create(
42 GpuChannelHost* gpu_channel_host, 42 GpuChannelHost* gpu_channel_host,
43 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, 43 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
44 const scoped_refptr<ContextProviderCommandBuffer>& context_provider); 44 const scoped_refptr<ContextProviderCommandBuffer>& context_provider);
45 45
46 // media::GpuVideoAcceleratorFactories implementation. 46 // media::GpuVideoAcceleratorFactories implementation.
47 virtual scoped_ptr<media::VideoDecodeAccelerator> 47 virtual scoped_ptr<media::VideoDecodeAccelerator>
48 CreateVideoDecodeAccelerator() OVERRIDE; 48 CreateVideoDecodeAccelerator() OVERRIDE;
49 virtual scoped_ptr<media::VideoEncodeAccelerator> 49 virtual scoped_ptr<media::VideoEncodeAccelerator>
50 CreateVideoEncodeAccelerator() OVERRIDE; 50 CreateVideoEncodeAccelerator() OVERRIDE;
51 // Creates textures and produces them into mailboxes. Returns true on success 51 // Creates textures and produces them into mailboxes. Returns true on success
52 // or false on failure. 52 // or false on failure.
53 virtual bool CreateTextures(int32 count, 53 virtual bool CreateTextures(int32 count,
54 const gfx::Size& size, 54 const gfx::Size& size,
55 std::vector<uint32>* texture_ids, 55 std::vector<uint32>* texture_ids,
56 std::vector<gpu::Mailbox>* texture_mailboxes, 56 std::vector<gpu::Mailbox>* texture_mailboxes,
57 uint32 texture_target) OVERRIDE; 57 uint32 texture_target) OVERRIDE;
58 virtual void DeleteTexture(uint32 texture_id) OVERRIDE; 58 virtual void DeleteTexture(uint32 texture_id) OVERRIDE;
59 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE; 59 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE;
60 virtual void ReadPixels(uint32 texture_id, 60 virtual void ReadPixels(uint32 texture_id,
61 const gfx::Rect& visible_rect, 61 const gfx::Rect& visible_rect,
62 const SkBitmap& pixels) OVERRIDE; 62 const SkBitmap& pixels) OVERRIDE;
63 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; 63 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE;
64 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() OVERRIDE; 64 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() OVERRIDE;
65 65
66 private: 66 private:
67 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>; 67 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>;
68 RendererGpuVideoAcceleratorFactories( 68 RendererGpuVideoAcceleratorFactories(
69 GpuChannelHost* gpu_channel_host, 69 GpuChannelHost* gpu_channel_host,
70 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, 70 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
71 const scoped_refptr<ContextProviderCommandBuffer>& context_provider); 71 const scoped_refptr<ContextProviderCommandBuffer>& context_provider);
72 virtual ~RendererGpuVideoAcceleratorFactories(); 72 virtual ~RendererGpuVideoAcceleratorFactories();
73 73
74 // Helper to bind |context_provider| to the |task_runner_| thread after 74 // Helper to bind |context_provider| to the |task_runner_| thread after
75 // construction. 75 // construction.
76 void BindContext(); 76 void BindContext();
77 77
78 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl, 78 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl,
79 // if it has not been lost yet. 79 // if it has not been lost yet.
80 WebGraphicsContext3DCommandBufferImpl* GetContext3d(); 80 WebGraphicsContext3DCommandBufferImpl* GetContext3d();
81 81
82 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 82 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
83 scoped_refptr<GpuChannelHost> gpu_channel_host_; 83 scoped_refptr<GpuChannelHost> gpu_channel_host_;
84 scoped_refptr<ContextProviderCommandBuffer> context_provider_; 84 scoped_refptr<ContextProviderCommandBuffer> context_provider_;
85 85
86 // For sending requests to allocate shared memory in the Browser process. 86 // For sending requests to allocate shared memory in the Browser process.
87 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 87 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); 89 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories);
90 }; 90 };
91 91
92 } // namespace content 92 } // namespace content
93 93
94 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ 94 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_
OLDNEW
« no previous file with comments | « content/renderer/media/buffered_data_source.cc ('k') | content/renderer/media/renderer_gpu_video_accelerator_factories.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698