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 @@
namespace media {
VaapiPicture::VaapiPicture(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id,
......@@ -21,7 +21,7 @@ VaapiPicture::VaapiPicture(
uint32_t texture_id,
uint32_t client_texture_id,
uint32_t texture_target)
: vaapi_wrapper_(vaapi_wrapper),
: vaapi_wrapper_(std::move(vaapi_wrapper)),
make_context_current_cb_(make_context_current_cb),
bind_image_cb_(bind_image_cb),
size_(size),
......
......@@ -48,14 +48,13 @@ class MEDIA_GPU_EXPORT VaapiPicture {
virtual bool AllowOverlay() const;
// Downloads |va_surface| into the picture, potentially scaling it if needed.
virtual bool DownloadFromSurface(
const scoped_refptr<VASurface>& va_surface) = 0;
virtual bool DownloadFromSurface(scoped_refptr<VASurface> va_surface) = 0;
// Returns the associated VASurfaceID, if any, or VA_INVALID_ID.
virtual VASurfaceID va_surface_id() const;
protected:
VaapiPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
VaapiPicture(scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id,
......
......@@ -41,7 +41,7 @@ VaapiPictureFactory::VaapiPictureFactory() = default;
VaapiPictureFactory::~VaapiPictureFactory() = default;
std::unique_ptr<VaapiPicture> VaapiPictureFactory::Create(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
const PictureBuffer& picture_buffer) {
......@@ -69,14 +69,14 @@ std::unique_ptr<VaapiPicture> VaapiPictureFactory::Create(
FALLTHROUGH;
case kVaapiImplementationDrm:
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,
client_texture_id, picture_buffer.texture_target()));
break;
#elif defined(USE_EGL)
case kVaapiImplementationDrm:
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,
client_texture_id, picture_buffer.texture_target()));
break;
......@@ -85,7 +85,7 @@ std::unique_ptr<VaapiPicture> VaapiPictureFactory::Create(
#if defined(USE_X11)
case kVaapiImplementationX11:
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,
client_texture_id, picture_buffer.texture_target()));
break;
......
......@@ -33,7 +33,7 @@ class MEDIA_GPU_EXPORT VaapiPictureFactory {
// Creates a VaapiPicture of picture_buffer.size() associated with
// picture_buffer.id().
virtual std::unique_ptr<VaapiPicture> Create(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
const PictureBuffer& picture_buffer);
......
......@@ -16,7 +16,7 @@
namespace media {
VaapiPictureNativePixmap::VaapiPictureNativePixmap(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id,
......@@ -24,7 +24,7 @@ VaapiPictureNativePixmap::VaapiPictureNativePixmap(
uint32_t texture_id,
uint32_t client_texture_id,
uint32_t texture_target)
: VaapiPicture(vaapi_wrapper,
: VaapiPicture(std::move(vaapi_wrapper),
make_context_current_cb,
bind_image_cb,
picture_buffer_id,
......@@ -36,9 +36,9 @@ VaapiPictureNativePixmap::VaapiPictureNativePixmap(
VaapiPictureNativePixmap::~VaapiPictureNativePixmap() = default;
bool VaapiPictureNativePixmap::DownloadFromSurface(
const scoped_refptr<VASurface>& va_surface) {
scoped_refptr<VASurface> va_surface) {
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 {
......
......@@ -26,7 +26,7 @@ class VaapiWrapper;
class VaapiPictureNativePixmap : public VaapiPicture {
public:
VaapiPictureNativePixmap(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb_,
int32_t picture_buffer_id,
......@@ -37,7 +37,7 @@ class VaapiPictureNativePixmap : public VaapiPicture {
~VaapiPictureNativePixmap() override;
// VaapiPicture implementation.
bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override;
bool DownloadFromSurface(scoped_refptr<VASurface> va_surface) override;
bool AllowOverlay() const override;
VASurfaceID va_surface_id() const override;
......
......@@ -17,7 +17,7 @@
namespace media {
VaapiPictureNativePixmapEgl::VaapiPictureNativePixmapEgl(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id,
......@@ -25,7 +25,7 @@ VaapiPictureNativePixmapEgl::VaapiPictureNativePixmapEgl(
uint32_t texture_id,
uint32_t client_texture_id,
uint32_t texture_target)
: VaapiPictureNativePixmap(vaapi_wrapper,
: VaapiPictureNativePixmap(std::move(vaapi_wrapper),
make_context_current_cb,
bind_image_cb,
picture_buffer_id,
......
......@@ -27,7 +27,7 @@ class VaapiWrapper;
class VaapiPictureNativePixmapEgl : public VaapiPictureNativePixmap {
public:
VaapiPictureNativePixmapEgl(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb_,
int32_t picture_buffer_id,
......
......@@ -17,7 +17,7 @@
namespace media {
VaapiPictureNativePixmapOzone::VaapiPictureNativePixmapOzone(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id,
......@@ -25,7 +25,7 @@ VaapiPictureNativePixmapOzone::VaapiPictureNativePixmapOzone(
uint32_t texture_id,
uint32_t client_texture_id,
uint32_t texture_target)
: VaapiPictureNativePixmap(vaapi_wrapper,
: VaapiPictureNativePixmap(std::move(vaapi_wrapper),
make_context_current_cb,
bind_image_cb,
picture_buffer_id,
......
......@@ -26,7 +26,7 @@ class VaapiWrapper;
class VaapiPictureNativePixmapOzone : public VaapiPictureNativePixmap {
public:
VaapiPictureNativePixmapOzone(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb_,
int32_t picture_buffer_id,
......
......@@ -14,7 +14,7 @@
namespace media {
VaapiTFPPicture::VaapiTFPPicture(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id,
......@@ -22,7 +22,7 @@ VaapiTFPPicture::VaapiTFPPicture(
uint32_t texture_id,
uint32_t client_texture_id,
uint32_t texture_target)
: VaapiPicture(vaapi_wrapper,
: VaapiPicture(std::move(vaapi_wrapper),
make_context_current_cb,
bind_image_cb,
picture_buffer_id,
......@@ -103,8 +103,7 @@ bool VaapiTFPPicture::ImportGpuMemoryBufferHandle(
return false;
}
bool VaapiTFPPicture::DownloadFromSurface(
const scoped_refptr<VASurface>& va_surface) {
bool VaapiTFPPicture::DownloadFromSurface(scoped_refptr<VASurface> va_surface) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), x_pixmap_,
va_surface->size());
......
......@@ -25,7 +25,7 @@ class VaapiWrapper;
// extension.
class VaapiTFPPicture : public VaapiPicture {
public:
VaapiTFPPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
VaapiTFPPicture(scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id,
......@@ -41,7 +41,7 @@ class VaapiTFPPicture : public VaapiPicture {
bool ImportGpuMemoryBufferHandle(
gfx::BufferFormat format,
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:
bool Initialize();
......
......@@ -84,7 +84,7 @@ class MockVaapiWrapper : public VaapiWrapper {
class MockVaapiPicture : public VaapiPicture {
public:
MockVaapiPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
MockVaapiPicture(scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
int32_t picture_buffer_id,
......@@ -92,7 +92,7 @@ class MockVaapiPicture : public VaapiPicture {
uint32_t texture_id,
uint32_t client_texture_id,
uint32_t texture_target)
: VaapiPicture(vaapi_wrapper,
: VaapiPicture(std::move(vaapi_wrapper),
make_context_current_cb,
bind_image_cb,
picture_buffer_id,
......@@ -109,8 +109,7 @@ class MockVaapiPicture : public VaapiPicture {
gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle) override {
return true;
}
bool DownloadFromSurface(
const scoped_refptr<VASurface>& va_surface) override {
bool DownloadFromSurface(scoped_refptr<VASurface> va_surface) override {
return true;
}
bool AllowOverlay() const override { return false; }
......@@ -127,7 +126,7 @@ class MockVaapiPictureFactory : public VaapiPictureFactory {
MOCK_METHOD2(MockCreateVaapiPicture, void(VaapiWrapper*, const gfx::Size&));
std::unique_ptr<VaapiPicture> Create(
const scoped_refptr<VaapiWrapper>& vaapi_wrapper,
scoped_refptr<VaapiWrapper> vaapi_wrapper,
const MakeGLContextCurrentCallback& make_context_current_cb,
const BindGLImageCallback& bind_image_cb,
const PictureBuffer& picture_buffer) override {
......@@ -135,7 +134,7 @@ class MockVaapiPictureFactory : public VaapiPictureFactory {
const uint32_t client_texture_id = picture_buffer.client_texture_ids()[0];
MockCreateVaapiPicture(vaapi_wrapper.get(), picture_buffer.size());
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,
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