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

Unified Diff: media/gpu/ipc/client/gpu_video_encode_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_encode_accelerator_host.cc
diff --git a/media/gpu/ipc/client/gpu_video_encode_accelerator_host.cc b/media/gpu/ipc/client/gpu_video_encode_accelerator_host.cc
index 5a1f3994e21597282489467867bcd0939bab73dc..4590723702a6509d10903abeadc468114dad7112 100644
--- a/media/gpu/ipc/client/gpu_video_encode_accelerator_host.cc
+++ b/media/gpu/ipc/client/gpu_video_encode_accelerator_host.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/threading/thread_task_runner_handle.h"
#include "gpu/ipc/client/gpu_channel_host.h"
+#include "media/base/bind_to_current_loop.h"
#include "media/base/video_frame.h"
#include "media/gpu/gpu_video_accelerator_util.h"
#include "media/gpu/ipc/common/media_messages.h"
@@ -26,12 +27,17 @@ GpuVideoEncodeAcceleratorHost::GpuVideoEncodeAcceleratorHost(
DCHECK(channel_);
DCHECK(impl_);
impl_->AddDeletionObserver(this);
+ channel_error_cb_ = media::BindToCurrentLoop(
danakj 2017/01/13 18:27:50 same
emircan 2017/01/13 19:08:14 Done.
+ base::Bind(&GpuVideoEncodeAcceleratorHost::OnChannelError,
+ weak_this_factory_.GetWeakPtr()));
}
GpuVideoEncodeAcceleratorHost::~GpuVideoEncodeAcceleratorHost() {
DCHECK(CalledOnValidThread());
if (channel_ && encoder_route_id_ != MSG_ROUTING_NONE)
channel_->RemoveRoute(encoder_route_id_);
+
+ base::AutoLock lock(impl_lock_);
if (impl_)
impl_->RemoveDeletionObserver(this);
}
@@ -83,6 +89,8 @@ bool GpuVideoEncodeAcceleratorHost::Initialize(
Client* client) {
DCHECK(CalledOnValidThread());
client_ = client;
+
+ base::AutoLock lock(impl_lock_);
if (!impl_) {
DLOG(ERROR) << "impl_ destroyed";
return false;
@@ -174,11 +182,11 @@ void GpuVideoEncodeAcceleratorHost::Destroy() {
}
void GpuVideoEncodeAcceleratorHost::OnWillDeleteImpl() {
- DCHECK(CalledOnValidThread());
+ base::AutoLock lock(impl_lock_);
impl_ = nullptr;
// The gpu::CommandBufferProxyImpl is going away; error out this VEA.
- OnChannelError();
+ channel_error_cb_.Run();
}
void GpuVideoEncodeAcceleratorHost::EncodeSharedMemoryFrame(

Powered by Google App Engine
This is Rietveld 408576698