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

Unified Diff: content/common/gpu/client/gpu_video_encode_accelerator_host.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/client/gpu_video_encode_accelerator_host.cc
diff --git a/content/common/gpu/client/gpu_video_encode_accelerator_host.cc b/content/common/gpu/client/gpu_video_encode_accelerator_host.cc
index edfb7b6349bf9c7fc91157ac7c4e29bcb520a7b4..14d330e960fb223ca43b4920d240f8559796fc5d 100644
--- a/content/common/gpu/client/gpu_video_encode_accelerator_host.cc
+++ b/content/common/gpu/client/gpu_video_encode_accelerator_host.cc
@@ -14,11 +14,9 @@
namespace content {
GpuVideoEncodeAcceleratorHost::GpuVideoEncodeAcceleratorHost(
- media::VideoEncodeAccelerator::Client* client,
const scoped_refptr<GpuChannelHost>& gpu_channel_host,
int32 route_id)
- : client_(client),
- client_ptr_factory_(client_),
+ : client_(NULL),
channel_(gpu_channel_host),
route_id_(route_id),
next_frame_id_(0) {
@@ -73,7 +71,10 @@ void GpuVideoEncodeAcceleratorHost::Initialize(
media::VideoFrame::Format input_format,
const gfx::Size& input_visible_size,
media::VideoCodecProfile output_profile,
- uint32 initial_bitrate) {
+ uint32 initial_bitrate,
+ Client* client) {
+ client_ = client;
+ client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client_));
Send(new AcceleratedVideoEncoderMsg_Initialize(route_id_,
input_format,
input_visible_size,
@@ -152,7 +153,7 @@ void GpuVideoEncodeAcceleratorHost::NotifyError(Error error) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(&media::VideoEncodeAccelerator::Client::NotifyError,
- client_ptr_factory_.GetWeakPtr(),
+ client_ptr_factory_->GetWeakPtr(),
error));
}
@@ -210,7 +211,7 @@ void GpuVideoEncodeAcceleratorHost::OnNotifyError(Error error) {
DVLOG(2) << "OnNotifyError(): error=" << error;
if (!client_)
return;
- client_ptr_factory_.InvalidateWeakPtrs();
+ client_ptr_factory_.reset();
// Client::NotifyError() may Destroy() |this|, so calling it needs to be the
// last thing done on this stack!

Powered by Google App Engine
This is Rietveld 408576698