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

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

Issue 2786503002: Potential deadlock in destructor of GpuJpegDecodeAcceleratorHost (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.cc
diff --git a/media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.cc b/media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.cc
index 1afe39c3db273df7c5e728c9d4cceb61e15e41f3..fca7a5b7741e500bcc18d6ebda152630076e6747 100644
--- a/media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.cc
+++ b/media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.cc
@@ -118,11 +118,14 @@ GpuJpegDecodeAcceleratorHost::~GpuJpegDecodeAcceleratorHost() {
// routed to |receiver_| on IO thread.
base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED);
- io_task_runner_->PostTask(FROM_HERE,
- base::Bind(&Receiver::InvalidateWeakPtr,
- base::Unretained(receiver_.get()),
- base::Unretained(&event)));
- event.Wait();
+ bool task_expected_to_run = io_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&Receiver::InvalidateWeakPtr,
+ base::Unretained(receiver_.get()),
+ base::Unretained(&event)));
+ // If the current call is happening during the browser shutdown, the
+ // |io_task_runner_| may no longer be accepting tasks.
+ if (task_expected_to_run)
+ event.Wait();
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698