Commit d25c3cf0 authored by Chih-Yu Huang's avatar Chih-Yu Huang Committed by Commit Bot

media/gpu/vaapi: Remove "const scoped_refptr<T>&" at VaapiPicture.

The Chromium smart pointer guidelines [1] says "don't pass or return a
smart pointer by reference". This CL remove "const scoped_refptr<T>&"
at VaapiPicture.

[1] https://www.chromium.org/developers/smart-pointer-guidelines

Bug: 1020668
Test: run vda_tests on octopus

Change-Id: I7b1c8d4066a6bba0d5ded4b1b584278168c49eea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1974725
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726365}
parent 2d7d258e
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace media { namespace media {
VaapiPicture::VaapiPicture( VaapiPicture::VaapiPicture(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id, int32_t picture_buffer_id,
...@@ -21,7 +21,7 @@ VaapiPicture::VaapiPicture( ...@@ -21,7 +21,7 @@ VaapiPicture::VaapiPicture(
uint32_t texture_id, uint32_t texture_id,
uint32_t client_texture_id, uint32_t client_texture_id,
uint32_t texture_target) uint32_t texture_target)
: vaapi_wrapper_(vaapi_wrapper), : vaapi_wrapper_(std::move(vaapi_wrapper)),
make_context_current_cb_(make_context_current_cb), make_context_current_cb_(make_context_current_cb),
bind_image_cb_(bind_image_cb), bind_image_cb_(bind_image_cb),
size_(size), size_(size),
......
...@@ -48,14 +48,13 @@ class MEDIA_GPU_EXPORT VaapiPicture { ...@@ -48,14 +48,13 @@ class MEDIA_GPU_EXPORT VaapiPicture {
virtual bool AllowOverlay() const; virtual bool AllowOverlay() const;
// Downloads |va_surface| into the picture, potentially scaling it if needed. // Downloads |va_surface| into the picture, potentially scaling it if needed.
virtual bool DownloadFromSurface( virtual bool DownloadFromSurface(scoped_refptr<VASurface> va_surface) = 0;
const scoped_refptr<VASurface>& va_surface) = 0;
// Returns the associated VASurfaceID, if any, or VA_INVALID_ID. // Returns the associated VASurfaceID, if any, or VA_INVALID_ID.
virtual VASurfaceID va_surface_id() const; virtual VASurfaceID va_surface_id() const;
protected: protected:
VaapiPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper, VaapiPicture(scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id, int32_t picture_buffer_id,
......
...@@ -41,7 +41,7 @@ VaapiPictureFactory::VaapiPictureFactory() = default; ...@@ -41,7 +41,7 @@ VaapiPictureFactory::VaapiPictureFactory() = default;
VaapiPictureFactory::~VaapiPictureFactory() = default; VaapiPictureFactory::~VaapiPictureFactory() = default;
std::unique_ptr<VaapiPicture> VaapiPictureFactory::Create( std::unique_ptr<VaapiPicture> VaapiPictureFactory::Create(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
const PictureBuffer& picture_buffer) { const PictureBuffer& picture_buffer) {
...@@ -69,14 +69,14 @@ std::unique_ptr<VaapiPicture> VaapiPictureFactory::Create( ...@@ -69,14 +69,14 @@ std::unique_ptr<VaapiPicture> VaapiPictureFactory::Create(
FALLTHROUGH; FALLTHROUGH;
case kVaapiImplementationDrm: case kVaapiImplementationDrm:
picture.reset(new VaapiPictureNativePixmapOzone( picture.reset(new VaapiPictureNativePixmapOzone(
vaapi_wrapper, make_context_current_cb, bind_image_cb, std::move(vaapi_wrapper), make_context_current_cb, bind_image_cb,
picture_buffer.id(), picture_buffer.size(), service_texture_id, picture_buffer.id(), picture_buffer.size(), service_texture_id,
client_texture_id, picture_buffer.texture_target())); client_texture_id, picture_buffer.texture_target()));
break; break;
#elif defined(USE_EGL) #elif defined(USE_EGL)
case kVaapiImplementationDrm: case kVaapiImplementationDrm:
picture.reset(new VaapiPictureNativePixmapEgl( picture.reset(new VaapiPictureNativePixmapEgl(
vaapi_wrapper, make_context_current_cb, bind_image_cb, std::move(vaapi_wrapper), make_context_current_cb, bind_image_cb,
picture_buffer.id(), picture_buffer.size(), service_texture_id, picture_buffer.id(), picture_buffer.size(), service_texture_id,
client_texture_id, picture_buffer.texture_target())); client_texture_id, picture_buffer.texture_target()));
break; break;
...@@ -85,7 +85,7 @@ std::unique_ptr<VaapiPicture> VaapiPictureFactory::Create( ...@@ -85,7 +85,7 @@ std::unique_ptr<VaapiPicture> VaapiPictureFactory::Create(
#if defined(USE_X11) #if defined(USE_X11)
case kVaapiImplementationX11: case kVaapiImplementationX11:
picture.reset(new VaapiTFPPicture( picture.reset(new VaapiTFPPicture(
vaapi_wrapper, make_context_current_cb, bind_image_cb, std::move(vaapi_wrapper), make_context_current_cb, bind_image_cb,
picture_buffer.id(), picture_buffer.size(), service_texture_id, picture_buffer.id(), picture_buffer.size(), service_texture_id,
client_texture_id, picture_buffer.texture_target())); client_texture_id, picture_buffer.texture_target()));
break; break;
......
...@@ -33,7 +33,7 @@ class MEDIA_GPU_EXPORT VaapiPictureFactory { ...@@ -33,7 +33,7 @@ class MEDIA_GPU_EXPORT VaapiPictureFactory {
// Creates a VaapiPicture of picture_buffer.size() associated with // Creates a VaapiPicture of picture_buffer.size() associated with
// picture_buffer.id(). // picture_buffer.id().
virtual std::unique_ptr<VaapiPicture> Create( virtual std::unique_ptr<VaapiPicture> Create(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
const PictureBuffer& picture_buffer); const PictureBuffer& picture_buffer);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
namespace media { namespace media {
VaapiPictureNativePixmap::VaapiPictureNativePixmap( VaapiPictureNativePixmap::VaapiPictureNativePixmap(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id, int32_t picture_buffer_id,
...@@ -24,7 +24,7 @@ VaapiPictureNativePixmap::VaapiPictureNativePixmap( ...@@ -24,7 +24,7 @@ VaapiPictureNativePixmap::VaapiPictureNativePixmap(
uint32_t texture_id, uint32_t texture_id,
uint32_t client_texture_id, uint32_t client_texture_id,
uint32_t texture_target) uint32_t texture_target)
: VaapiPicture(vaapi_wrapper, : VaapiPicture(std::move(vaapi_wrapper),
make_context_current_cb, make_context_current_cb,
bind_image_cb, bind_image_cb,
picture_buffer_id, picture_buffer_id,
...@@ -36,9 +36,9 @@ VaapiPictureNativePixmap::VaapiPictureNativePixmap( ...@@ -36,9 +36,9 @@ VaapiPictureNativePixmap::VaapiPictureNativePixmap(
VaapiPictureNativePixmap::~VaapiPictureNativePixmap() = default; VaapiPictureNativePixmap::~VaapiPictureNativePixmap() = default;
bool VaapiPictureNativePixmap::DownloadFromSurface( bool VaapiPictureNativePixmap::DownloadFromSurface(
const scoped_refptr<VASurface>& va_surface) { scoped_refptr<VASurface> va_surface) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); return vaapi_wrapper_->BlitSurface(std::move(va_surface), va_surface_);
} }
bool VaapiPictureNativePixmap::AllowOverlay() const { bool VaapiPictureNativePixmap::AllowOverlay() const {
......
...@@ -26,7 +26,7 @@ class VaapiWrapper; ...@@ -26,7 +26,7 @@ class VaapiWrapper;
class VaapiPictureNativePixmap : public VaapiPicture { class VaapiPictureNativePixmap : public VaapiPicture {
public: public:
VaapiPictureNativePixmap( VaapiPictureNativePixmap(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb_, const BindGLImageCallback& bind_image_cb_,
int32_t picture_buffer_id, int32_t picture_buffer_id,
...@@ -37,7 +37,7 @@ class VaapiPictureNativePixmap : public VaapiPicture { ...@@ -37,7 +37,7 @@ class VaapiPictureNativePixmap : public VaapiPicture {
~VaapiPictureNativePixmap() override; ~VaapiPictureNativePixmap() override;
// VaapiPicture implementation. // VaapiPicture implementation.
bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; bool DownloadFromSurface(scoped_refptr<VASurface> va_surface) override;
bool AllowOverlay() const override; bool AllowOverlay() const override;
VASurfaceID va_surface_id() const override; VASurfaceID va_surface_id() const override;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
namespace media { namespace media {
VaapiPictureNativePixmapEgl::VaapiPictureNativePixmapEgl( VaapiPictureNativePixmapEgl::VaapiPictureNativePixmapEgl(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id, int32_t picture_buffer_id,
...@@ -25,7 +25,7 @@ VaapiPictureNativePixmapEgl::VaapiPictureNativePixmapEgl( ...@@ -25,7 +25,7 @@ VaapiPictureNativePixmapEgl::VaapiPictureNativePixmapEgl(
uint32_t texture_id, uint32_t texture_id,
uint32_t client_texture_id, uint32_t client_texture_id,
uint32_t texture_target) uint32_t texture_target)
: VaapiPictureNativePixmap(vaapi_wrapper, : VaapiPictureNativePixmap(std::move(vaapi_wrapper),
make_context_current_cb, make_context_current_cb,
bind_image_cb, bind_image_cb,
picture_buffer_id, picture_buffer_id,
......
...@@ -27,7 +27,7 @@ class VaapiWrapper; ...@@ -27,7 +27,7 @@ class VaapiWrapper;
class VaapiPictureNativePixmapEgl : public VaapiPictureNativePixmap { class VaapiPictureNativePixmapEgl : public VaapiPictureNativePixmap {
public: public:
VaapiPictureNativePixmapEgl( VaapiPictureNativePixmapEgl(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb_, const BindGLImageCallback& bind_image_cb_,
int32_t picture_buffer_id, int32_t picture_buffer_id,
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
namespace media { namespace media {
VaapiPictureNativePixmapOzone::VaapiPictureNativePixmapOzone( VaapiPictureNativePixmapOzone::VaapiPictureNativePixmapOzone(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id, int32_t picture_buffer_id,
...@@ -25,7 +25,7 @@ VaapiPictureNativePixmapOzone::VaapiPictureNativePixmapOzone( ...@@ -25,7 +25,7 @@ VaapiPictureNativePixmapOzone::VaapiPictureNativePixmapOzone(
uint32_t texture_id, uint32_t texture_id,
uint32_t client_texture_id, uint32_t client_texture_id,
uint32_t texture_target) uint32_t texture_target)
: VaapiPictureNativePixmap(vaapi_wrapper, : VaapiPictureNativePixmap(std::move(vaapi_wrapper),
make_context_current_cb, make_context_current_cb,
bind_image_cb, bind_image_cb,
picture_buffer_id, picture_buffer_id,
......
...@@ -26,7 +26,7 @@ class VaapiWrapper; ...@@ -26,7 +26,7 @@ class VaapiWrapper;
class VaapiPictureNativePixmapOzone : public VaapiPictureNativePixmap { class VaapiPictureNativePixmapOzone : public VaapiPictureNativePixmap {
public: public:
VaapiPictureNativePixmapOzone( VaapiPictureNativePixmapOzone(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb_, const BindGLImageCallback& bind_image_cb_,
int32_t picture_buffer_id, int32_t picture_buffer_id,
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
namespace media { namespace media {
VaapiTFPPicture::VaapiTFPPicture( VaapiTFPPicture::VaapiTFPPicture(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id, int32_t picture_buffer_id,
...@@ -22,7 +22,7 @@ VaapiTFPPicture::VaapiTFPPicture( ...@@ -22,7 +22,7 @@ VaapiTFPPicture::VaapiTFPPicture(
uint32_t texture_id, uint32_t texture_id,
uint32_t client_texture_id, uint32_t client_texture_id,
uint32_t texture_target) uint32_t texture_target)
: VaapiPicture(vaapi_wrapper, : VaapiPicture(std::move(vaapi_wrapper),
make_context_current_cb, make_context_current_cb,
bind_image_cb, bind_image_cb,
picture_buffer_id, picture_buffer_id,
...@@ -103,8 +103,7 @@ bool VaapiTFPPicture::ImportGpuMemoryBufferHandle( ...@@ -103,8 +103,7 @@ bool VaapiTFPPicture::ImportGpuMemoryBufferHandle(
return false; return false;
} }
bool VaapiTFPPicture::DownloadFromSurface( bool VaapiTFPPicture::DownloadFromSurface(scoped_refptr<VASurface> va_surface) {
const scoped_refptr<VASurface>& va_surface) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), x_pixmap_, return vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), x_pixmap_,
va_surface->size()); va_surface->size());
......
...@@ -25,7 +25,7 @@ class VaapiWrapper; ...@@ -25,7 +25,7 @@ class VaapiWrapper;
// extension. // extension.
class VaapiTFPPicture : public VaapiPicture { class VaapiTFPPicture : public VaapiPicture {
public: public:
VaapiTFPPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper, VaapiTFPPicture(scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id, int32_t picture_buffer_id,
...@@ -41,7 +41,7 @@ class VaapiTFPPicture : public VaapiPicture { ...@@ -41,7 +41,7 @@ class VaapiTFPPicture : public VaapiPicture {
bool ImportGpuMemoryBufferHandle( bool ImportGpuMemoryBufferHandle(
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle) override; gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle) override;
bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; bool DownloadFromSurface(scoped_refptr<VASurface> va_surface) override;
private: private:
bool Initialize(); bool Initialize();
......
...@@ -84,7 +84,7 @@ class MockVaapiWrapper : public VaapiWrapper { ...@@ -84,7 +84,7 @@ class MockVaapiWrapper : public VaapiWrapper {
class MockVaapiPicture : public VaapiPicture { class MockVaapiPicture : public VaapiPicture {
public: public:
MockVaapiPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper, MockVaapiPicture(scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id, int32_t picture_buffer_id,
...@@ -92,7 +92,7 @@ class MockVaapiPicture : public VaapiPicture { ...@@ -92,7 +92,7 @@ class MockVaapiPicture : public VaapiPicture {
uint32_t texture_id, uint32_t texture_id,
uint32_t client_texture_id, uint32_t client_texture_id,
uint32_t texture_target) uint32_t texture_target)
: VaapiPicture(vaapi_wrapper, : VaapiPicture(std::move(vaapi_wrapper),
make_context_current_cb, make_context_current_cb,
bind_image_cb, bind_image_cb,
picture_buffer_id, picture_buffer_id,
...@@ -109,8 +109,7 @@ class MockVaapiPicture : public VaapiPicture { ...@@ -109,8 +109,7 @@ class MockVaapiPicture : public VaapiPicture {
gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle) override { gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle) override {
return true; return true;
} }
bool DownloadFromSurface( bool DownloadFromSurface(scoped_refptr<VASurface> va_surface) override {
const scoped_refptr<VASurface>& va_surface) override {
return true; return true;
} }
bool AllowOverlay() const override { return false; } bool AllowOverlay() const override { return false; }
...@@ -127,7 +126,7 @@ class MockVaapiPictureFactory : public VaapiPictureFactory { ...@@ -127,7 +126,7 @@ class MockVaapiPictureFactory : public VaapiPictureFactory {
MOCK_METHOD2(MockCreateVaapiPicture, void(VaapiWrapper*, const gfx::Size&)); MOCK_METHOD2(MockCreateVaapiPicture, void(VaapiWrapper*, const gfx::Size&));
std::unique_ptr<VaapiPicture> Create( std::unique_ptr<VaapiPicture> Create(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper, scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
const PictureBuffer& picture_buffer) override { const PictureBuffer& picture_buffer) override {
...@@ -135,7 +134,7 @@ class MockVaapiPictureFactory : public VaapiPictureFactory { ...@@ -135,7 +134,7 @@ class MockVaapiPictureFactory : public VaapiPictureFactory {
const uint32_t client_texture_id = picture_buffer.client_texture_ids()[0]; const uint32_t client_texture_id = picture_buffer.client_texture_ids()[0];
MockCreateVaapiPicture(vaapi_wrapper.get(), picture_buffer.size()); MockCreateVaapiPicture(vaapi_wrapper.get(), picture_buffer.size());
return std::make_unique<MockVaapiPicture>( return std::make_unique<MockVaapiPicture>(
vaapi_wrapper, make_context_current_cb, bind_image_cb, std::move(vaapi_wrapper), make_context_current_cb, bind_image_cb,
picture_buffer.id(), picture_buffer.size(), service_texture_id, picture_buffer.id(), picture_buffer.size(), service_texture_id,
client_texture_id, picture_buffer.texture_target()); client_texture_id, picture_buffer.texture_target());
} }
......
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