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..d4fd1c14b19d41f44a9f883428e32eebde25a84a 100644 |
--- a/content/common/gpu/client/gpu_video_encode_accelerator_host.cc |
+++ b/content/common/gpu/client/gpu_video_encode_accelerator_host.cc |
@@ -14,14 +14,9 @@ |
namespace content { |
GpuVideoEncodeAcceleratorHost::GpuVideoEncodeAcceleratorHost( |
Ami GONE FROM CHROMIUM
2014/02/24 23:12:40
NULL-init client_
sheu
2014/02/24 23:48:20
Done.
|
- media::VideoEncodeAccelerator::Client* client, |
const scoped_refptr<GpuChannelHost>& gpu_channel_host, |
int32 route_id) |
- : client_(client), |
- client_ptr_factory_(client_), |
- channel_(gpu_channel_host), |
- route_id_(route_id), |
- next_frame_id_(0) { |
+ : channel_(gpu_channel_host), route_id_(route_id), next_frame_id_(0) { |
channel_->AddRoute(route_id_, AsWeakPtr()); |
} |
@@ -70,10 +65,13 @@ void GpuVideoEncodeAcceleratorHost::OnChannelError() { |
} |
void GpuVideoEncodeAcceleratorHost::Initialize( |
+ Client* client, |
media::VideoFrame::Format input_format, |
const gfx::Size& input_visible_size, |
media::VideoCodecProfile output_profile, |
uint32 initial_bitrate) { |
+ client_ = client; |
+ client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client_)); |
Send(new AcceleratedVideoEncoderMsg_Initialize(route_id_, |
input_format, |
input_visible_size, |
@@ -152,7 +150,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 +208,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! |