Commit dc76fee1 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

GpuVideoAcceleratorFactories: moar constness

Minor cleanups around GVAF & co:
 - const/constexpr
 - early return
 - use = default iso {} [1]

Otherwise no new code, unit tests and such should
cover it all.

[1] https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/qgU4mh_MpGA

Bug: 803975
Change-Id: I7a14a28a3b7ee3703885e40ec0829cc6b4453592
Reviewed-on: https://chromium-review.googlesource.com/897707
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarEmircan Uysaler <emircan@chromium.org>
Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534202}
parent 9e91e72c
...@@ -271,10 +271,8 @@ GpuVideoAcceleratorFactoriesImpl::CreateGpuMemoryBuffer( ...@@ -271,10 +271,8 @@ GpuVideoAcceleratorFactoriesImpl::CreateGpuMemoryBuffer(
const gfx::Size& size, const gfx::Size& size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) { gfx::BufferUsage usage) {
std::unique_ptr<gfx::GpuMemoryBuffer> buffer = return gpu_memory_buffer_manager_->CreateGpuMemoryBuffer(
gpu_memory_buffer_manager_->CreateGpuMemoryBuffer( size, format, usage, gpu::kNullSurfaceHandle);
size, format, usage, gpu::kNullSurfaceHandle);
return buffer;
} }
bool GpuVideoAcceleratorFactoriesImpl::ShouldUseGpuMemoryBuffersForVideoFrames() bool GpuVideoAcceleratorFactoriesImpl::ShouldUseGpuMemoryBuffersForVideoFrames()
const { const {
......
...@@ -123,9 +123,9 @@ class CONTENT_EXPORT GpuVideoAcceleratorFactoriesImpl ...@@ -123,9 +123,9 @@ class CONTENT_EXPORT GpuVideoAcceleratorFactoriesImpl
void BindVideoEncodeAcceleratorProviderOnTaskRunner( void BindVideoEncodeAcceleratorProviderOnTaskRunner(
media::mojom::VideoEncodeAcceleratorProviderPtrInfo unbound_vea_provider); media::mojom::VideoEncodeAcceleratorProviderPtrInfo unbound_vea_provider);
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; const scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_; const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_; const scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_;
// Shared pointer to a shared context provider that should be accessed // Shared pointer to a shared context provider that should be accessed
// and set only on the main thread. // and set only on the main thread.
...@@ -137,7 +137,7 @@ class CONTENT_EXPORT GpuVideoAcceleratorFactoriesImpl ...@@ -137,7 +137,7 @@ class CONTENT_EXPORT GpuVideoAcceleratorFactoriesImpl
base::UnguessableToken channel_token_; base::UnguessableToken channel_token_;
// Whether gpu memory buffers should be used to hold video frames data. // Whether gpu memory buffers should be used to hold video frames data.
bool enable_gpu_memory_buffer_video_frames_; const bool enable_gpu_memory_buffer_video_frames_;
// Whether video acceleration encoding/decoding should be enabled. // Whether video acceleration encoding/decoding should be enabled.
const bool video_accelerator_enabled_; const bool video_accelerator_enabled_;
......
...@@ -188,7 +188,7 @@ namespace { ...@@ -188,7 +188,7 @@ namespace {
// VideoFrame copies to GpuMemoryBuffers will be split in copies where the // VideoFrame copies to GpuMemoryBuffers will be split in copies where the
// output size is |kBytesPerCopyTarget| bytes and run in parallel. // output size is |kBytesPerCopyTarget| bytes and run in parallel.
const size_t kBytesPerCopyTarget = 1024 * 1024; // 1MB constexpr size_t kBytesPerCopyTarget = 1024 * 1024; // 1MB
// Return the GpuMemoryBuffer format to use for a specific VideoPixelFormat // Return the GpuMemoryBuffer format to use for a specific VideoPixelFormat
// and plane. // and plane.
......
...@@ -55,9 +55,10 @@ class MEDIA_EXPORT GpuVideoAcceleratorFactories { ...@@ -55,9 +55,10 @@ class MEDIA_EXPORT GpuVideoAcceleratorFactories {
public: public:
class ScopedGLContextLock { class ScopedGLContextLock {
public: public:
ScopedGLContextLock() {} ScopedGLContextLock() = default;
virtual ~ScopedGLContextLock() = default;
virtual gpu::gles2::GLES2Interface* ContextGL() = 0; virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
virtual ~ScopedGLContextLock(){};
private: private:
DISALLOW_COPY_AND_ASSIGN(ScopedGLContextLock); DISALLOW_COPY_AND_ASSIGN(ScopedGLContextLock);
...@@ -144,7 +145,7 @@ class MEDIA_EXPORT GpuVideoAcceleratorFactories { ...@@ -144,7 +145,7 @@ class MEDIA_EXPORT GpuVideoAcceleratorFactories {
protected: protected:
friend class base::RefCounted<GpuVideoAcceleratorFactories>; friend class base::RefCounted<GpuVideoAcceleratorFactories>;
virtual ~GpuVideoAcceleratorFactories() {} virtual ~GpuVideoAcceleratorFactories() = default;
}; };
} // namespace media } // namespace media
......
...@@ -68,8 +68,7 @@ class MockGpuVideoAcceleratorFactories : public GpuVideoAcceleratorFactories { ...@@ -68,8 +68,7 @@ class MockGpuVideoAcceleratorFactories : public GpuVideoAcceleratorFactories {
return video_frame_output_format_; return video_frame_output_format_;
}; };
std::unique_ptr<GpuVideoAcceleratorFactories::ScopedGLContextLock> std::unique_ptr<ScopedGLContextLock> GetGLContextLock() override;
GetGLContextLock() override;
void SetVideoFrameOutputFormat(const OutputFormat video_frame_output_format) { void SetVideoFrameOutputFormat(const OutputFormat video_frame_output_format) {
video_frame_output_format_ = video_frame_output_format; video_frame_output_format_ = video_frame_output_format;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment