Commit 858b4170 authored by Eric Karl's avatar Eric Karl Committed by Commit Bot

Do not add destruction observer to PooledSharedImageVideoProvider

PooledSharedImageVideoProvider::GpuHelperImpl currently registers
a stub destruction observer in its constructor. It does not remove
this observer in its destructor, which can lead to a crash when
CommandBufferStub attempts to notify it of destruction.

I was going to unregister in destruction, but then noticed that
this observer isn't needed:
- CommandBufferHelper already registers its own observer internally
- GpuHelperImpl just used this notification to clear
  |command_buffer_helper_|, which is already taken care of internally
  in that class.

So instead this CL just removes the observer from GpuHelperImpl.

Bug: 1010612
Change-Id: I47d1982d6ccaf8624650a4274e8cb1500aba4f9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1835168Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Commit-Queue: Eric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702204}
parent e6ee7ea5
......@@ -188,7 +188,6 @@ PooledSharedImageVideoProvider::GpuHelperImpl::GpuHelperImpl(
: weak_factory_(this) {
gpu::CommandBufferStub* stub = get_stub_cb.Run();
if (stub) {
stub->AddDestructionObserver(this);
command_buffer_helper_ = CommandBufferHelper::Create(stub);
}
}
......@@ -214,9 +213,4 @@ void PooledSharedImageVideoProvider::GpuHelperImpl::OnSyncTokenCleared(
std::move(cb).Run();
}
void PooledSharedImageVideoProvider::GpuHelperImpl::OnWillDestroyStub(
bool have_context) {
command_buffer_helper_ = nullptr;
}
} // namespace media
......@@ -57,8 +57,7 @@ class MEDIA_GPU_EXPORT PooledSharedImageVideoProvider
base::SequenceBound<GpuHelper> gpu_helper,
std::unique_ptr<SharedImageVideoProvider> provider);
class GpuHelperImpl : public GpuHelper,
public gpu::CommandBufferStub::DestructionObserver {
class GpuHelperImpl : public GpuHelper {
public:
GpuHelperImpl(GetStubCB get_stub_cb);
~GpuHelperImpl() override;
......@@ -68,9 +67,6 @@ class MEDIA_GPU_EXPORT PooledSharedImageVideoProvider
scoped_refptr<CodecImageHolder> codec_image_holder,
base::OnceClosure cb) override;
// gpu::CommandBufferStub::DestructionObserver
void OnWillDestroyStub(bool have_context) override;
private:
void OnSyncTokenCleared(scoped_refptr<CodecImageHolder> codec_image_holder,
base::OnceClosure cb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment