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(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage) {
std::unique_ptr<gfx::GpuMemoryBuffer> buffer =
gpu_memory_buffer_manager_->CreateGpuMemoryBuffer(
return gpu_memory_buffer_manager_->CreateGpuMemoryBuffer(
size, format, usage, gpu::kNullSurfaceHandle);
return buffer;
}
bool GpuVideoAcceleratorFactoriesImpl::ShouldUseGpuMemoryBuffersForVideoFrames()
const {
......
......@@ -123,9 +123,9 @@ class CONTENT_EXPORT GpuVideoAcceleratorFactoriesImpl
void BindVideoEncodeAcceleratorProviderOnTaskRunner(
media::mojom::VideoEncodeAcceleratorProviderPtrInfo unbound_vea_provider);
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_;
const scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
const scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_;
// Shared pointer to a shared context provider that should be accessed
// and set only on the main thread.
......@@ -137,7 +137,7 @@ class CONTENT_EXPORT GpuVideoAcceleratorFactoriesImpl
base::UnguessableToken channel_token_;
// 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.
const bool video_accelerator_enabled_;
......
......@@ -188,7 +188,7 @@ namespace {
// VideoFrame copies to GpuMemoryBuffers will be split in copies where the
// 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
// and plane.
......
......@@ -55,9 +55,10 @@ class MEDIA_EXPORT GpuVideoAcceleratorFactories {
public:
class ScopedGLContextLock {
public:
ScopedGLContextLock() {}
ScopedGLContextLock() = default;
virtual ~ScopedGLContextLock() = default;
virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
virtual ~ScopedGLContextLock(){};
private:
DISALLOW_COPY_AND_ASSIGN(ScopedGLContextLock);
......@@ -144,7 +145,7 @@ class MEDIA_EXPORT GpuVideoAcceleratorFactories {
protected:
friend class base::RefCounted<GpuVideoAcceleratorFactories>;
virtual ~GpuVideoAcceleratorFactories() {}
virtual ~GpuVideoAcceleratorFactories() = default;
};
} // namespace media
......
......@@ -68,8 +68,7 @@ class MockGpuVideoAcceleratorFactories : public GpuVideoAcceleratorFactories {
return video_frame_output_format_;
};
std::unique_ptr<GpuVideoAcceleratorFactories::ScopedGLContextLock>
GetGLContextLock() override;
std::unique_ptr<ScopedGLContextLock> GetGLContextLock() override;
void SetVideoFrameOutputFormat(const OutputFormat 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