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

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

Issue 65803002: Replace MessageLoopProxy with SingleThreadTaskRunner for media/filters/ + associated code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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
« no previous file with comments | « no previous file | content/renderer/media/renderer_gpu_video_accelerator_factories.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "content/child/thread_safe_sender.h" 14 #include "content/child/thread_safe_sender.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "media/filters/gpu_video_accelerator_factories.h" 16 #include "media/filters/gpu_video_accelerator_factories.h"
17 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
18 #include "ui/gfx/size.h" 18 #include "ui/gfx/size.h"
19 19
20 namespace base { 20 namespace base {
21 class MessageLoopProxy;
22 class WaitableEvent; 21 class WaitableEvent;
23 } 22 }
24 23
25 namespace content { 24 namespace content {
26 class ContextProviderCommandBuffer; 25 class ContextProviderCommandBuffer;
27 class GpuChannelHost; 26 class GpuChannelHost;
28 class WebGraphicsContext3DCommandBufferImpl; 27 class WebGraphicsContext3DCommandBufferImpl;
29 28
30 // Glue code to expose functionality needed by media::GpuVideoAccelerator to 29 // Glue code to expose functionality needed by media::GpuVideoAccelerator to
31 // RenderViewImpl. This class is entirely an implementation detail of 30 // RenderViewImpl. This class is entirely an implementation detail of
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 std::vector<uint32>* texture_ids, 62 std::vector<uint32>* texture_ids,
64 std::vector<gpu::Mailbox>* texture_mailboxes, 63 std::vector<gpu::Mailbox>* texture_mailboxes,
65 uint32 texture_target) OVERRIDE; 64 uint32 texture_target) OVERRIDE;
66 virtual void DeleteTexture(uint32 texture_id) OVERRIDE; 65 virtual void DeleteTexture(uint32 texture_id) OVERRIDE;
67 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE; 66 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE;
68 // ReadPixels() is safe to call from any thread. 67 // ReadPixels() is safe to call from any thread.
69 virtual void ReadPixels(uint32 texture_id, 68 virtual void ReadPixels(uint32 texture_id,
70 const gfx::Size& size, 69 const gfx::Size& size,
71 const SkBitmap& pixels) OVERRIDE; 70 const SkBitmap& pixels) OVERRIDE;
72 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; 71 virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE;
73 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE; 72 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() OVERRIDE;
74 virtual void Abort() OVERRIDE; 73 virtual void Abort() OVERRIDE;
75 virtual bool IsAborted() OVERRIDE; 74 virtual bool IsAborted() OVERRIDE;
76 scoped_refptr<RendererGpuVideoAcceleratorFactories> Clone(); 75 scoped_refptr<RendererGpuVideoAcceleratorFactories> Clone();
77 76
78 protected: 77 protected:
79 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>; 78 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>;
80 virtual ~RendererGpuVideoAcceleratorFactories(); 79 virtual ~RendererGpuVideoAcceleratorFactories();
81 80
82 private: 81 private:
83 RendererGpuVideoAcceleratorFactories(); 82 RendererGpuVideoAcceleratorFactories();
84 83
85 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl, 84 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl,
86 // if it has not been lost yet. 85 // if it has not been lost yet.
87 WebGraphicsContext3DCommandBufferImpl* GetContext3d(); 86 WebGraphicsContext3DCommandBufferImpl* GetContext3d();
88 87
89 // Helper for the constructor to acquire the ContentGLContext on 88 // Helper for the constructor to acquire the ContentGLContext on
90 // |message_loop_|. 89 // |task_runner_|.
91 void AsyncBindContext(); 90 void AsyncBindContext();
92 91
93 // Async versions of the public methods, run on |message_loop_|. 92 // Async versions of the public methods, run on |task_runner_|.
94 // They use output parameters instead of return values and each takes 93 // They use output parameters instead of return values and each takes
95 // a WaitableEvent* param to signal completion (except for DeleteTexture, 94 // a WaitableEvent* param to signal completion (except for DeleteTexture,
96 // which is fire-and-forget). 95 // which is fire-and-forget).
97 // AsyncCreateVideoDecodeAccelerator returns its output in the |vda_| member. 96 // AsyncCreateVideoDecodeAccelerator returns its output in the |vda_| member.
98 void AsyncCreateVideoDecodeAccelerator( 97 void AsyncCreateVideoDecodeAccelerator(
99 media::VideoCodecProfile profile, 98 media::VideoCodecProfile profile,
100 media::VideoDecodeAccelerator::Client* client); 99 media::VideoDecodeAccelerator::Client* client);
101 void AsyncReadPixels(uint32 texture_id, const gfx::Size& size); 100 void AsyncReadPixels(uint32 texture_id, const gfx::Size& size);
102 void AsyncDestroyVideoDecodeAccelerator(); 101 void AsyncDestroyVideoDecodeAccelerator();
103 102
104 scoped_refptr<base::MessageLoopProxy> message_loop_; 103 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
105 scoped_refptr<GpuChannelHost> gpu_channel_host_; 104 scoped_refptr<GpuChannelHost> gpu_channel_host_;
106 scoped_refptr<ContextProviderCommandBuffer> context_provider_; 105 scoped_refptr<ContextProviderCommandBuffer> context_provider_;
107 106
108 // For sending requests to allocate shared memory in the Browser process. 107 // For sending requests to allocate shared memory in the Browser process.
109 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 108 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
110 109
111 // This event is signaled if we have been asked to Abort(). 110 // This event is signaled if we have been asked to Abort().
112 base::WaitableEvent aborted_waiter_; 111 base::WaitableEvent aborted_waiter_;
113 112
114 // This event is signaled by asynchronous tasks posted to |message_loop_| to 113 // This event is signaled by asynchronous tasks posted to |task_runner_| to
115 // indicate their completion. 114 // indicate their completion.
116 // e.g. AsyncCreateVideoDecodeAccelerator()/AsyncCreateTextures() etc. 115 // e.g. AsyncCreateVideoDecodeAccelerator()/AsyncCreateTextures() etc.
117 base::WaitableEvent message_loop_async_waiter_; 116 base::WaitableEvent task_runner_async_waiter_;
118 117
119 // The vda returned by the CreateVideoDecodeAccelerator function. 118 // The vda returned by the CreateVideoDecodeAccelerator function.
120 scoped_ptr<media::VideoDecodeAccelerator> vda_; 119 scoped_ptr<media::VideoDecodeAccelerator> vda_;
121 120
122 // Bitmap returned by ReadPixels(). 121 // Bitmap returned by ReadPixels().
123 SkBitmap read_pixels_bitmap_; 122 SkBitmap read_pixels_bitmap_;
124 123
125 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); 124 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories);
126 }; 125 };
127 126
128 } // namespace content 127 } // namespace content
129 128
130 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ 129 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/renderer_gpu_video_accelerator_factories.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698