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

Unified Diff: components/keyed_service/core/refcounted_keyed_service.cc

Issue 2581213002: Force HostContentSettingsMap to be destroyed on its owning thread. (Closed)
Patch Set: s/STRH comparison/RunsTasksOnCurrentThread/ Created 4 years 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 | « components/keyed_service/core/refcounted_keyed_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/keyed_service/core/refcounted_keyed_service.cc
diff --git a/components/keyed_service/core/refcounted_keyed_service.cc b/components/keyed_service/core/refcounted_keyed_service.cc
index 6bc47584c5a54dab2885fb4628aad084c3c2f9df..04a1ea572889ff96ffff4721e8e794a5369efdf5 100644
--- a/components/keyed_service/core/refcounted_keyed_service.cc
+++ b/components/keyed_service/core/refcounted_keyed_service.cc
@@ -4,15 +4,13 @@
#include "components/keyed_service/core/refcounted_keyed_service.h"
-#include "base/location.h"
-#include "base/threading/thread_task_runner_handle.h"
+#include <utility>
namespace impl {
// static
void RefcountedKeyedServiceTraits::Destruct(const RefcountedKeyedService* obj) {
- if (obj->task_runner_.get() != nullptr &&
- obj->task_runner_.get() != base::ThreadTaskRunnerHandle::Get()) {
+ if (obj->task_runner_ && !obj->task_runner_->RunsTasksOnCurrentThread()) {
obj->task_runner_->DeleteSoon(FROM_HERE, obj);
} else {
delete obj;
@@ -25,9 +23,7 @@ RefcountedKeyedService::RefcountedKeyedService() : task_runner_(nullptr) {
}
RefcountedKeyedService::RefcountedKeyedService(
- const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
- : task_runner_(task_runner) {
-}
+ scoped_refptr<base::SequencedTaskRunner> task_runner)
+ : task_runner_(std::move(task_runner)) {}
-RefcountedKeyedService::~RefcountedKeyedService() {
-}
+RefcountedKeyedService::~RefcountedKeyedService() = default;
« no previous file with comments | « components/keyed_service/core/refcounted_keyed_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698