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

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

Issue 170843004: Pass Client pointer in Initialize() for VDA/VEA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 50e826de Rebase. Created 6 years, 10 months 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/v4l2_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/v4l2_video_decode_accelerator.cc b/content/common/gpu/media/v4l2_video_decode_accelerator.cc
index 992e6afe61942cad230fdd6ada7991d48cba7a2b..68baaa85c845c91dda916e544ddd9e15e27431a3 100644
--- a/content/common/gpu/media/v4l2_video_decode_accelerator.cc
+++ b/content/common/gpu/media/v4l2_video_decode_accelerator.cc
@@ -154,7 +154,6 @@ V4L2VideoDecodeAccelerator::PictureRecord::~PictureRecord() {}
V4L2VideoDecodeAccelerator::V4L2VideoDecodeAccelerator(
EGLDisplay egl_display,
- Client* client,
const base::WeakPtr<Client>& io_client,
const base::Callback<bool(void)>& make_context_current,
scoped_ptr<V4L2Device> device,
@@ -162,8 +161,6 @@ V4L2VideoDecodeAccelerator::V4L2VideoDecodeAccelerator(
: child_message_loop_proxy_(base::MessageLoopProxy::current()),
io_message_loop_proxy_(io_message_loop_proxy),
weak_this_(base::AsWeakPtr(this)),
- client_ptr_factory_(client),
- client_(client_ptr_factory_.GetWeakPtr()),
io_client_(io_client),
decoder_thread_("V4L2DecoderThread"),
decoder_state_(kUninitialized),
@@ -202,12 +199,15 @@ V4L2VideoDecodeAccelerator::~V4L2VideoDecodeAccelerator() {
DCHECK(output_buffer_map_.empty());
}
-bool V4L2VideoDecodeAccelerator::Initialize(
- media::VideoCodecProfile profile) {
+bool V4L2VideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
+ Client* client) {
DVLOG(3) << "Initialize()";
DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
DCHECK_EQ(decoder_state_, kUninitialized);
+ client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client));
+ client_ = client_ptr_factory_->GetWeakPtr();
+
switch (profile) {
case media::H264PROFILE_BASELINE:
DVLOG(2) << "Initialize(): profile H264PROFILE_BASELINE";
@@ -427,7 +427,7 @@ void V4L2VideoDecodeAccelerator::Destroy() {
DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
// We're destroying; cancel all callbacks.
- client_ptr_factory_.InvalidateWeakPtrs();
+ client_ptr_factory_.reset();
// If the decoder thread is running, destroy using posted task.
if (decoder_thread_.IsRunning()) {
@@ -1587,7 +1587,7 @@ void V4L2VideoDecodeAccelerator::NotifyError(Error error) {
if (client_) {
client_->NotifyError(error);
- client_ptr_factory_.InvalidateWeakPtrs();
+ client_ptr_factory_.reset();
}
}
« no previous file with comments | « content/common/gpu/media/v4l2_video_decode_accelerator.h ('k') | content/common/gpu/media/vaapi_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698