1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/keyed_service/core/refcounted_keyed_service.h"
7 #include "base/location.h"
8 #include "base/thread_task_runner_handle.h"
13 void RefcountedKeyedServiceTraits::Destruct(const RefcountedKeyedService
* obj
) {
14 if (obj
->task_runner_
.get() != nullptr &&
15 obj
->task_runner_
.get() != base::ThreadTaskRunnerHandle::Get()) {
16 obj
->task_runner_
->DeleteSoon(FROM_HERE
, obj
);
24 RefcountedKeyedService::RefcountedKeyedService() : task_runner_(nullptr) {
27 RefcountedKeyedService::RefcountedKeyedService(
28 const scoped_refptr
<base::SingleThreadTaskRunner
>& task_runner
)
29 : task_runner_(task_runner
) {
32 RefcountedKeyedService::~RefcountedKeyedService() {