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. 4 5#ifndef COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_H_ 6#define COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_H_ 7 8#include "components/keyed_service/core/keyed_service_export.h" 9 10// Interface for keyed services that support two-phase destruction order. 11// 12// Two-phase shutdown allows keyed services to have a first pass shutdown phase 13// where they drop references. Not all services will need this, so there's a 14// default implementation. Only once every service has been given a chance to 15// drop references are services deleted. 16class KEYED_SERVICE_EXPORT KeyedService { 17 public: 18 KeyedService(); 19 20 // The first pass is to call Shutdown on a KeyedService. 21 virtual void Shutdown(); 22 23 // The second pass is the actual deletion of each object. 24 virtual ~KeyedService(); 25}; 26 27#endif // COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_H_ 28