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

Unified Diff: content/common/gpu/media/vaapi_drm_picture.cc

Issue 1432963003: [Ozone] Extends the lifetime of VaapiWrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOT for upstream Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/media/vaapi_drm_picture.cc
diff --git a/content/common/gpu/media/vaapi_drm_picture.cc b/content/common/gpu/media/vaapi_drm_picture.cc
index d344a1b5138a97c986e13709283e2bce9fb1e18b..94f50dd5783b3a4cc0babfea11c813721039da19 100644
--- a/content/common/gpu/media/vaapi_drm_picture.cc
+++ b/content/common/gpu/media/vaapi_drm_picture.cc
@@ -20,22 +20,21 @@
namespace content {
VaapiDrmPicture::VaapiDrmPicture(
- VaapiWrapper* vaapi_wrapper,
+ scoped_refptr<VaapiWrapper> vaapi_wrapper,
const base::Callback<bool(void)>& make_context_current,
int32 picture_buffer_id,
uint32 texture_id,
const gfx::Size& size)
: VaapiPicture(picture_buffer_id, texture_id, size),
vaapi_wrapper_(vaapi_wrapper),
- make_context_current_(make_context_current),
- weak_this_factory_(this) {
-}
+ make_context_current_(make_context_current) {}
VaapiDrmPicture::~VaapiDrmPicture() {
if (gl_image_ && make_context_current_.Run()) {
gl_image_->ReleaseTexImage(GL_TEXTURE_EXTERNAL_OES);
gl_image_->Destroy(true);
+ LOG(WARNING) << "qxie2:" << __FUNCTION__ << ", gl_image:" << gl_image_;
DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR));
}
}
@@ -116,11 +115,8 @@ bool VaapiDrmPicture::Initialize() {
return false;
}
- // Weak pointers can only bind to methods without return values,
- // hence we cannot bind ScalePixmap here. Instead we use a
- // static function to solve this problem.
- pixmap_->SetScalingCallback(base::Bind(&VaapiDrmPicture::CallScalePixmap,
- weak_this_factory_.GetWeakPtr()));
+ scoped_refptr<VaapiDrmPicture> ref = this;
Pawel Osciak 2015/11/16 04:24:35 This shouldn't be required. You should be able to
william.xie1 2015/11/16 08:07:25 Done.
+ pixmap_->SetScalingCallback(base::Bind(&VaapiDrmPicture::ScalePixmap, ref));
if (!make_context_current_.Run())
return false;
@@ -147,18 +143,6 @@ bool VaapiDrmPicture::DownloadFromSurface(
return vaapi_wrapper_->BlitSurface(va_surface, va_surface_);
}
-// static
-scoped_refptr<ui::NativePixmap> VaapiDrmPicture::CallScalePixmap(
- base::WeakPtr<VaapiDrmPicture> weak_ptr,
- gfx::Size new_size) {
- if (!weak_ptr.get()) {
- LOG(ERROR) << "Failed scaling NativePixmap as scaling "
- "unit(VaapiDrmPicture) is deleted";
- return nullptr;
- }
- return weak_ptr->ScalePixmap(new_size);
-}
-
scoped_refptr<ui::NativePixmap> VaapiDrmPicture::ScalePixmap(
gfx::Size new_size) {
if (!scaled_va_surface_.get() || scaled_va_surface_->size() != new_size) {

Powered by Google App Engine
This is Rietveld 408576698