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

Unified Diff: media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc

Issue 2627173002: Adds locks for CommandBufferProxyImpl invalidation (Closed)
Patch Set: Created 3 years, 11 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: media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc
diff --git a/media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc b/media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc
index 94d53179e207707debf6a7cd2b11cbc96dab5ddd..cf5a85045f2f736b39abdd354105e462235946fa 100644
--- a/media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc
+++ b/media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc
@@ -12,6 +12,7 @@
#include "gpu/ipc/client/gpu_channel_host.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
+#include "media/base/bind_to_current_loop.h"
#include "media/gpu/ipc/common/media_messages.h"
namespace media {
@@ -26,6 +27,9 @@ GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost(
DCHECK(channel_);
DCHECK(impl_);
impl_->AddDeletionObserver(this);
+ channel_error_cb_ = media::BindToCurrentLoop(
danakj 2017/01/13 18:27:50 Just store a task runner and bind/post to it from
emircan 2017/01/13 19:08:14 Done.
+ base::Bind(&GpuVideoDecodeAcceleratorHost::OnChannelError,
+ weak_this_factory_.GetWeakPtr()));
}
GpuVideoDecodeAcceleratorHost::~GpuVideoDecodeAcceleratorHost() {
@@ -33,6 +37,8 @@ GpuVideoDecodeAcceleratorHost::~GpuVideoDecodeAcceleratorHost() {
if (channel_ && decoder_route_id_ != MSG_ROUTING_NONE)
channel_->RemoveRoute(decoder_route_id_);
+
+ base::AutoLock lock(impl_lock_);
if (impl_)
impl_->RemoveDeletionObserver(this);
}
@@ -79,6 +85,7 @@ bool GpuVideoDecodeAcceleratorHost::Initialize(const Config& config,
DCHECK(CalledOnValidThread());
client_ = client;
+ base::AutoLock lock(impl_lock_);
if (!impl_)
return false;
@@ -180,11 +187,11 @@ void GpuVideoDecodeAcceleratorHost::Destroy() {
}
void GpuVideoDecodeAcceleratorHost::OnWillDeleteImpl() {
- DCHECK(CalledOnValidThread());
+ base::AutoLock lock(impl_lock_);
impl_ = NULL;
// The gpu::CommandBufferProxyImpl is going away; error out this VDA.
- OnChannelError();
+ channel_error_cb_.Run();
}
void GpuVideoDecodeAcceleratorHost::PostNotifyError(Error error) {

Powered by Google App Engine
This is Rietveld 408576698