Commit 191a217d authored by Tsuyoshi Horo's avatar Tsuyoshi Horo Committed by Commit Bot

Use DeleteSoon to delete BundledExchangesBlobDataSource's Core

Bug: 1018640
Change-Id: Ifeed5db772abface2d6ed9a6b12c3f6e0a8481e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893127Reviewed-by: default avatarKunihiko Sakamoto <ksakamoto@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711653}
parent 917706c0
...@@ -119,7 +119,8 @@ BundledExchangesBlobDataSource::BundledExchangesBlobDataSource( ...@@ -119,7 +119,8 @@ BundledExchangesBlobDataSource::BundledExchangesBlobDataSource(
BundledExchangesBlobDataSource::~BundledExchangesBlobDataSource() { BundledExchangesBlobDataSource::~BundledExchangesBlobDataSource() {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DeleteCore(std::move(core_)); if (core_)
base::DeleteSoon(FROM_HERE, {BrowserThread::IO}, std::move(core_));
auto tasks = std::move(pending_get_core_tasks_); auto tasks = std::move(pending_get_core_tasks_);
for (auto& task : tasks) { for (auto& task : tasks) {
...@@ -157,23 +158,12 @@ void BundledExchangesBlobDataSource::SetCoreOnUI( ...@@ -157,23 +158,12 @@ void BundledExchangesBlobDataSource::SetCoreOnUI(
if (!weak_ptr) { if (!weak_ptr) {
// This happens when the BundledExchangesBlobDataSource was deleted before // This happens when the BundledExchangesBlobDataSource was deleted before
// SetCoreOnUI() is called. // SetCoreOnUI() is called.
DeleteCore(std::move(core)); base::DeleteSoon(FROM_HERE, {BrowserThread::IO}, std::move(core));
return; return;
} }
weak_ptr->SetCoreOnUIImpl(std::move(weak_core), std::move(core)); weak_ptr->SetCoreOnUIImpl(std::move(weak_core), std::move(core));
} }
// static
void BundledExchangesBlobDataSource::DeleteCore(
std::unique_ptr<BlobDataSourceCore> core) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!core)
return;
base::PostTask(FROM_HERE, {BrowserThread::IO},
base::BindOnce([](std::unique_ptr<BlobDataSourceCore> core) {},
std::move(core)));
}
void BundledExchangesBlobDataSource::ReadToDataPipe( void BundledExchangesBlobDataSource::ReadToDataPipe(
uint64_t offset, uint64_t offset,
uint64_t length, uint64_t length,
......
...@@ -116,8 +116,6 @@ class CONTENT_EXPORT BundledExchangesBlobDataSource { ...@@ -116,8 +116,6 @@ class CONTENT_EXPORT BundledExchangesBlobDataSource {
base::WeakPtr<BlobDataSourceCore> weak_core, base::WeakPtr<BlobDataSourceCore> weak_core,
std::unique_ptr<BlobDataSourceCore> core); std::unique_ptr<BlobDataSourceCore> core);
static void DeleteCore(std::unique_ptr<BlobDataSourceCore> core);
void WaitForCore(base::OnceClosure callback); void WaitForCore(base::OnceClosure callback);
void ReadToDataPipeImpl(uint64_t offset, void ReadToDataPipeImpl(uint64_t offset,
......
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