Commit dc14c3e4 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Migrate off BrowserThread::DeleteSoon in /chromecast/browser

Instead use base::DeleteSoon which enforces usage of TaskTraits.

This CL is a no-op as-is. It was recently discovered however that some
callers did BrowserThread::DeleteSoon() with pending tasks running on
different task queues (different traits  -- e.g.

TaskTraits to make this more obvious. Please review whether calls in
this CL can be migrated as-is or need additional traits to match
potentially pending tasks.

Split from https://chromium-review.googlesource.com/c/chromium/src/+/1894109
for cursory review.

This CL was uploaded by git cl split.

R=seantopping@chromium.org


TaskPriority: :BEST_EFFORT) which can result in out-of-order deletion...
BrowserThread: :DeleteSoon() is being migrated to base::DeleteSoon() w/
Bug: 1019767
Change-Id: I5caea21fdb526caf65a2d918b64a58661e552019
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895653
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarSean Topping <seantopping@chromium.org>
Commit-Queue: Sean Topping <seantopping@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711802}
parent 10a173d7
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/task/post_task.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chromecast/base/cast_paths.h" #include "chromecast/base/cast_paths.h"
#include "chromecast/browser/cast_download_manager_delegate.h" #include "chromecast/browser/cast_download_manager_delegate.h"
#include "chromecast/browser/cast_permission_manager.h" #include "chromecast/browser/cast_permission_manager.h"
#include "chromecast/browser/url_request_context_factory.h" #include "chromecast/browser/url_request_context_factory.h"
#include "components/keyed_service/core/simple_key_map.h" #include "components/keyed_service/core/simple_key_map.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/cors_origin_pattern_setter.h" #include "content/public/browser/cors_origin_pattern_setter.h"
#include "content/public/browser/resource_context.h" #include "content/public/browser/resource_context.h"
...@@ -58,8 +60,8 @@ CastBrowserContext::~CastBrowserContext() { ...@@ -58,8 +60,8 @@ CastBrowserContext::~CastBrowserContext() {
SimpleKeyMap::GetInstance()->Dissociate(this); SimpleKeyMap::GetInstance()->Dissociate(this);
BrowserContext::NotifyWillBeDestroyed(this); BrowserContext::NotifyWillBeDestroyed(this);
ShutdownStoragePartitions(); ShutdownStoragePartitions();
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, base::DeleteSoon(FROM_HERE, {content::BrowserThread::IO},
resource_context_.release()); resource_context_.release());
} }
void CastBrowserContext::InitWhileIOAllowed() { void CastBrowserContext::InitWhileIOAllowed() {
......
...@@ -179,8 +179,8 @@ CastContentBrowserClient::~CastContentBrowserClient() { ...@@ -179,8 +179,8 @@ CastContentBrowserClient::~CastContentBrowserClient() {
DCHECK(!media_resource_tracker_) DCHECK(!media_resource_tracker_)
<< "ResetMediaResourceTracker was not called"; << "ResetMediaResourceTracker was not called";
cast_network_contexts_.reset(); cast_network_contexts_.reset();
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, base::DeleteSoon(FROM_HERE, {content::BrowserThread::IO},
url_request_context_factory_.release()); url_request_context_factory_.release());
} }
std::unique_ptr<CastService> CastContentBrowserClient::CreateCastService( std::unique_ptr<CastService> CastContentBrowserClient::CreateCastService(
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
...@@ -68,7 +69,7 @@ void CastExtensionMessageFilter::OnDestruct() const { ...@@ -68,7 +69,7 @@ void CastExtensionMessageFilter::OnDestruct() const {
if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
delete this; delete this;
} else { } else {
BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); base::DeleteSoon(FROM_HERE, {BrowserThread::UI}, this);
} }
} }
......
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