Make castv2 performance test work.
[chromium-blink-merge.git] / components / keyed_service / core / refcounted_keyed_service.cc
blobd5ff3f9410852ec6fe66bb7c00ca17dac48e9d52
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"
10 namespace impl {
12 // static
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);
17 } else {
18 delete obj;
22 } // namespace impl
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() {